僅使用批處理腳本就比較容易。我會將要部署的路徑添加到單獨的文件中。它可以做這樣的:
@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