Powershell 中的 MSdeploy - 展示或帮助我一些真正有效的东西
我在工作中设置了 TFS Deployer,并尝试编写用于部署的 Powershell 脚本。我已经在 StackoverFlow 上研究并阅读了许多发布的问题和答案,但我还无法真正使脚本正常工作。
到目前为止,当我在 Windows PowerShell ISE 上运行以下 PS 时,它会运行。
$envMsDeploy = $env:msdeploy
$DirMsDeploy = split-Path -Parent $envMsDeploy
# 将当前位置定义为 $DirMSDeploy = C:\Program Files\IIS\Microsoft Web Deploy V2
设置位置 $DirMsDeploy
$arg = @(
'-动词:同步';
'-source:contentPath=' + $buildDroppedLocation;
'-dest:contentPath=' + $destinationPath;
'-如果> c:\temp\msdeploy.log'
)
$runMSDeploy = ($DirMsDeploy + "\Msdeploy.exe " + $arg)
$runMSDeploy | $runMSDeploy |输出文件 c:\temp\MsDeployTest.bat
我放置最后一句是为了确认 $runMSDeploy 保存的内容。现在看起来 $runMSDeploy 保存了我最后想要放置的内容。
MSDeployTest.Bat 包含 C:\Program Files\IIS\Microsoft Web Deploy V2\Msdeploy.exe -verb:sync -source:contentPath=[[c:\source 文件夹]] -dest:contentPath=[[目标 UNC 路径]] -如果> c:\temp\msdeploy.log
这是我现在陷入困境的地方。由于 c:\Program 文件包含空文件夹,cmd 无法成功运行,而是给出错误,“cmd.exe : 'C:\Program' 未被识别为内部或外部命令”
如果您有任何建议或想法,请告诉我。
谢谢,
每天都想粉碎
I set up TFS Deployer currenlty at work and have been tried to write a Powershell script for the deployment. I have been researched and read many posted questions and answers at StackoverFlow but I couldn't really making the script working yet.
So far, when I run the following PS on windows PowerShell ISE, it runs.
$envMsDeploy = $env:msdeploy
$DirMsDeploy = split-Path -Parent $envMsDeploy
# defined the current location to $DirMSDeploy = C:\Program Files\IIS\Microsoft Web Deploy V2
set-location $DirMsDeploy
$arg = @(
'-verb:sync';
'-source:contentPath=' + $buildDroppedLocation;
'-dest:contentPath=' + $destinationPath;
' -whatif > c:\temp\msdeploy.log'
)
$runMSDeploy = ($DirMsDeploy + "\Msdeploy.exe " + $arg)
$runMSDeploy | Out-file c:\temp\MsDeployTest.bat
I put the last sentence to confirm what gets saved $runMSDeploy. Now looks like $runMSDeploy saves what I want to put finally.
MSDeployTest.Bat contains C:\Program Files\IIS\Microsoft Web Deploy V2\Msdeploy.exe -verb:sync -source:contentPath=[[c:\source folder]] -dest:contentPath=[[Detination UNC path]] -whatif > c:\temp\msdeploy.log
This is where I'm stuck at right now. Because of the c:\Program files contains the empty folder, cmd doesn't run successfully rather giving me the error, "cmd.exe : 'C:\Program' is not recognized as an internal or external command"
If you have any suggestions or idea, please let me know.
thanks,
wanttogoshreddingeveryday
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
启动 notepad.exe 的小示例
这是一个使用参数JP
Here is a small example which start notepad.exe with a parametter
JP
试试这个要点。它应该拥有通过 powershell 部署所需的一切 https://gist.github.com/579086
它使用不过,没有它也能工作。
Try this gist. It should have everything you need to deploy via powershell https://gist.github.com/579086
It uses Psake, but it will work without it as well.