本文讲的方案实现以下功能:利用winscp和putty的脚本功能,实现在Window平台上编写代码,上传到Linux进行编译,然后取编译结果。需要用到3个文件,分别如下:
(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公社 www.LinuxIDC.com 】
%winscp% /console /script=synchronize.script /parameter %username% %password% %server% %port% %localpath% %remotepath%
echo "Send Done!"
:: 创建make shell
echo cd %remotepath% > make.sh
:: echo make clean >> make.sh
echo make 1^>make.out 2^>make.out >> make.sh
:: 执行make
%putty% -pw %password% %username%@%server% -P %port% -m make.sh
echo "Make Done!"
:: 把make的结果传递到客户端
%winscp% /console /script=aftermake.script /parameter %username% %password% %server% %port% %localpath% %remotepath%
:: 显示make后的结果
cat make.out
pause
http://www.bkjia.com/gjrj/800041.html