天天看點

windows BAT自動化上傳檔案到linux server, 執行遠端腳本

windows BAT自動化上傳檔案到linux server使用pscp, 執行遠端腳本使用plink

pscp, plink的登入兩種方式:用參數pw寫上密碼 或者 用參數i使用私鑰進行身份驗證(要求server端配置了公鑰,配置方法參考精彩PuTTY 中文教程)

直接執行linux指令

pscp -pw password filename [email protected]:directory

pscp -i %putty%/privateKey.ppk filename [email protected]:directory

plink -pw pwd [email protected] ls;ls

将指令寫在本地檔案中

plink -pw pwd [email protected] -m local_script.txt

執行server上的shell腳本

plink -i %putty%/privateKey.ppk [email protected] ./shell.sh

pscp, plink 參考 putty

繼續閱讀