仅使用批处理脚本就比较容易。我会将要部署的路径添加到单独的文件中。它可以做这样的:
@echo off
set "scriptPath=/where/the/files/are"
for /F %%a IN (deployment-list.txt) DO (
REM Will prompt for password and set T: (temp) drive to path
net use T: \\%%a /u:administrator *
copy %scriptPath%\ExampleMVC.zip t:\
net use t: /d
)
或者只有一个路径和无环路:
REM Will prompt for password and set T: (temp) drive to path
net use T: \\iisprod1\inetpub\wwwroot\iapps /u:administrator *
copy \path\to\file\ExampleMVC.zip t:\
net use t: /d
此外,如果你想拥有所提取的内容,只需先提取,并在复制内容或者像这样:
REM Will prompt for password and set T: (temp) drive to path
net use T: \\iisprod1\inetpub\wwwroot\iapps /u:administrator *
copy \path\to\file\ExampleMVC\* t:\
net use t: /d