2016-12-06 113 views
0

继执行时抛出的错误是我的msdeploy命令从一个服务器复制到另一个文件(到server2)成功:msdeploy命令从.bat文件

MSDeploy.exe -source:contentPath="C:\inetpub\wwwroot\dist",computerName="https://server1:8172/MSDeploy.axd",username="administrator",password="XXXXXXXXX",authtype="Basic" -allowUntrusted -dest:contentPath='C:\Builds\dist',computerName="https://server2:8172/MSDeploy.axd",username="administrator",password="XXXXXXXXXX",authtype="Basic",includeAcls="False" -verb:sync -allowUntrusted 

我还有一个类似的命令正是因为以上在server3server4之间传输文件以及从命令提示符运行成功。然而,当我把这些命令中的一个或两个在.bat文件,收到以下错误:

enter image description here

下面是我的批处理文件的具体内容:

@ECHO OFF 

CD C:\Program Files\IIS\Microsoft Web Deploy V3 

MSDeploy.exe -source:contentPath="C:\inetpub\wwwroot\dist",computerName="https://server1:8172/MSDeploy.axd",username="administrator",password="XXXXXXXXX",authtype="Basic" -allowUntrusted -dest:contentPath='C:\Builds\dist',computerName="https://server2:8172/MSDeploy.axd",username="administrator",password="XXXXXXXXXX",authtype="Basic",includeAcls="False" -verb:sync -allowUntrusted 

MSDeploy.exe -source:contentPath="C:\inetpub\wwwroot\dist",computerName="https://server3:8172/MSDeploy.axd",username="administrator",password="XXXXXXXXX",authtype="Basic" -allowUntrusted -dest:contentPath='C:\Builds\dist',computerName="https://server4:8172/MSDeploy.axd",username="administrator",password="XXXXXXXXXX",authtype="Basic",includeAcls="False" -verb:sync -allowUntrusted 

我试图运行的一个管理员,仍然是同样的问题。令我惊讶的是,与其他一些服务器完全相同的命令也可以在.bat文件中正常工作。

+1

你打算使用单引号“C:\构建\ DIST”? – RGuggisberg

+0

不,双引号是我所知道的正确方式 – Srini

+1

'CD C:\ Program Files \ IIS \ Microsoft Web Deploy V3'需要围绕目录名称,因为它包含空格。 – DavidPostill

回答

0

使用cmd /c执行批处理文件正在工作。通常需要使用cmd /c来将控制返回到bat文件,即使有致命的错误。不知道只有这个原因的确切原因,因为在我的情况下没有致命的错误。

检查这个以了解更多信息A .bat File, "Call" or Not to "Call", That is the