How to run a powershell script with white spaces in path from command line?

后端 未结 5 1290
既然无缘
既然无缘 2020-12-03 10:36

So I\'ve tried a bunch of different ways to run a powershell script from the command line and every single one returns an error.

Here is this path:



        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-03 11:31

    To add to this topic:

    I needed to pass a parameter with spaces.

    I am dragging and dropping a file onto a batch file, and the file is off on the server with spaces in the path and/or file name. After testing the above answers I got this to work. Note I am changing to the working directory prior to starting powershell.

    Batch file:

    pushd O:\Data\QuickList
    start powershell -noexit -Command ".\QuickList.ps1 -datafile '%1'"
    popd
    

提交回复
热议问题