powershell web.deploy.cmd位置参数

时间:2014-02-10 15:39:38

标签: powershell powershell-v2.0 webdeploy

我在使用PowerShell,Web部署和转义命令路径时遇到了大问题。我正在尝试在部署之前使用Web部署中的runCommand提供程序运行powershell脚本。但是,即使我用双引号括起来,powershell似乎也将空格解释为单独的参数。

如果我运行

,这就是输出
web.deploy.cmd /y

Info: Updating runCommand (powershell.exe -ExecutionPolicy Bypass invoke-command "C:/local dev/mobile/Core/Web services/wsAuthUser/mobilestability/src/wsAuthUser/obj/Debug/Package/PackageTmp/install/installboot.ps1" -computername server01 -argumentlist Mobile2/AuthUser, pre).

但错误是:

Warning: Invoke-Command : A positional parameter cannot be found that accepts a
gument '

Warning: dev/mobile/Core/Web'.
At line:1 char:15

当整个路径都在引号中时,为什么会抱怨?

更新

如果我将以下内容粘贴到Powershell ISE中:

invoke-command "C:\group dev\mobile\Core\Web Services\wsAuthUser\mobilestability\src\wsAuthUser\obj\Debug\Package\PackageTmp\bin\install\installboot.ps1" -computername dev-mob2iis01 -argumentlist Mobile2/AuthUser, pre

运行正常,没有错误。

如果我然后打开一个命令提示符,通过相同的命令,但预先挂起powershell和执行策略参数,如下所示:

powershell.exe -ExecutionPolicy Bypass invoke-command "C:\localdev\mobile\Core\Web Services\wsAuthUser\mobilestability\src\wsAuthUser\obj\Debug\Package\PackageTmp\bin\install\installboot.ps1" -computername server01 -argumentlist Mobile2/AuthUser, pre

再次失败。

1 个答案:

答案 0 :(得分:0)

因为它是windows,而不是unix。因此,您将使用反斜杠作为文件路径,而不是常规斜杠。

更新: 你只需要使用引号来使其通过cmd工作

powershell.exe -ExecutionPolicy Bypass -command "invoke-command 'C:\localdev\mobile\Core\Web Services\wsAuthUser\mobilestability\src\wsAuthUser\obj\Debug\Package\PackageTmp\bin\install\installboot.ps1' -computername server01 -argumentlist Mobile2/AuthUser, pre"
相关问题