我正在尝试在 PowerShell 中运行以下命令
PS C:\Users\Administrator> cmd /c "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\vsdevcmd.bat && nuget restore && msbuild mywebapp.sln /p:DeployOnBuild=true /p:PublishedProfile=ServerFolderProfile"
Run Code Online (Sandbox Code Playgroud)
这会产生错误
'C:\Program' is not recognized as an internal or external command.
Run Code Online (Sandbox Code Playgroud)
我的路径有空格,我正在运行几个由 && 分隔的命令,这把一切搞乱了。我尝试过在各处添加引号,但无法使其正常工作。
如果我只运行命令的第一部分
cmd /c "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\vsdevcmd.bat"
Run Code Online (Sandbox Code Playgroud)
效果很好。但我也无法让其他命令工作。