我正在尝试从 Powershell 中运行以下命令:
msdeploy -verb:sync -source:archiveDir=c:\KitchenPC\Build -dest:appHostConfig="KitchenPC",computerName=https://192.168.0.3:8172/msdeploy.axd,authType=Basic,userName=someuser,password="secret" -allowUntrusted
docs say简单地替换
:
在每个参数后面加一个 =
.所以我试过这个:msdeploy -verb=sync -source=archiveDir=c:\KitchenPC\Build -dest=appHostConfig="KitchenPC",computerName=https://192.168.0.3:8172/msdeploy.axd,authType=Basic,userName=someuser,password="secret" -allowUntrusted
但是,我收到错误:
Error: Unrecognized argument 'computerName=https://192.168.0.3:8172/msdeploy.axd'. All arguments must begin with "-". Error count: 1.
我检查了 docs on provider settings ,但是他们没有提到他们等效的 Powershell 语法。
最佳答案
How do you call msdeploy from powershell when the parameters have spaces?
认为这已经回答了,只需修改它。
前任。使用变量包括“KitchenPC”和“secret”,并将 -dest 部分放在引号内。
工作示例:
msdeploy '-verb=sync' '-source=archiveDir=c:\KitchenPC\Build -dest=appHostConfig="KitchenPC",computerName=https://192.168.0.3:8172/msdeploy.axd,authType=Basic,userName=someuser,password="secret"' -allowUntrusted
(注意每个命令行参数周围的单引号)
关于powershell - 从 Powershell 中运行 msdeploy.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12993278/