本文講的方案實現如下功能:利用winscp和putty的腳本功能,實如今Window平臺上編寫代碼,上傳到Linux進行編譯,而後取編譯結果。須要用到3個文件,分別以下:html
(1) synchronize.bat
----------------------------------------
:: 須要更改 WinSCP.exe 和 putty.exe 的路徑
:: 須要設置的變量
@SET localpath=E:\work\projectname
@SET remotepath=/home/username/work/projectname
@SET server=192.168.1.168
@SET port=22
@SET username=username
@SET password=123456
@SET winscp="D:\Program Files\WinSCP\WinSCP.exe"
@SET putty="D:\Program Files\WinSCP\PuTTY\putty.exe"linux
:: 發生文件到linux機器 【LINUX公社 www.LinuxIDC.com 】
%winscp% /console /script=synchronize.script /parameter %username% %password% %server% %port% %localpath% %remotepath%shell
echo "Send Done!"server
:: 建立make shell
echo cd %remotepath% > make.sh
:: echo make clean >> make.sh
echo make 1^>make.out 2^>make.out >> make.shhtm
:: 執行make
%putty% -pw %password% %username%@%server% -P %port% -m make.ship
echo "Make Done!"rem
:: 把make的結果傳遞到客戶端
%winscp% /console /script=aftermake.script /parameter %username% %password% %server% %port% %localpath% %remotepath%console
:: 顯示make後的結果
cat make.out編譯
pause變量
http://www.bkjia.com/gjrj/800041.html