【发布时间】:2014-02-10 15:39:37
【问题描述】:
我在使用 powershell、Web 部署和转义命令路径时遇到了大问题。我正在尝试使用 Web Deploy 中的 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
又失败了。
【问题讨论】:
标签: powershell powershell-2.0 webdeploy