Windows推包指令碼

來源:互聯網
上載者:User

標籤:client   data   ping   highlight   工具   ken   成功   psexec   error   

關於Windows的推包升級可以用自動化工具,但如果機器數量不多,使用指令碼效率更高,這裡使用到PsExec.exe工具。

結構:

initServer.bat

work.bat

PsExec.exe

files(要推的檔案)

resSuccess.log(執行成功的日誌)

resFaild.log(執行失敗的日誌)

 

init.bat是把serverPWD.txt 裡面目標ip和密碼傳到work.bat。

initServer.bat

echo -----start at:%data% %time%----->resSuccess.logecho -----start at:%data% %time%----->resFaild.logfor /F “tokens=1,2 delims=:” %%i in(serverPWD.txt)do(call work.bat %%i %%j)echo -----end at:%data% %time%----->resSuccess.logecho -----end at:%data% %time%----->resFaild.log

 

work.bat的作用是把files裡的檔案拷貝到目標機器上,然後執行上面的指令碼。

work.bat

set ip=%1%set pwd=%2%set files=filesnet use \\%ip% “%pwd%” /user:”administrator”if %errorlevel% EQU 0 (xcopy /S /E /Y %files% \\%ip%\C$ping 127.0.0.1 –n 2start cmd /c PsExec.exe \\%ip% -u administrator –p %pwd% -w C:\client C:\client\run.batnet use \\%ip%\IPC$ /delecho %ip%>> resSuccess.log)else(echo %ip%>> resFaild.log)

  

Windows推包指令碼

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.