The scenario described in this article implements the following functions: Using the scripting capabilities of WINSCP and putty to write code on the window platform, upload to Linux for compilation, and then take the compiled results. 3 files are required, respectively:
(1) Synchronize.bat
----------------------------------------
:: Need to change paths for WinSCP.exe and Putty.exe
:: Variables that need to be set
@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"
:: Occurs file to Linux machine "Linux commune www.LinuxIDC.com"
%winscp%/console/script=synchronize.script/parameter%username%%password%%server%%port%%localpath%%remotepath%
echo "Send done!"
:: Create a make shell
echo CD%remotepath% > make.sh
:: Echo Make clean >> make.sh
echo Make 1^>make.out 2^>make.out >> make.sh
:: Execute Make
%putty%-PW%password%%username%@%server%-P%port%-M make.sh
echo "Make done!"
:: Pass the result of make to the client
%winscp%/console/script=aftermake.script/parameter%username%%password%%server%%port%%localpath%%remotepath%
:: Show results after make
Cat Make.out
Pause
Http://www.bkjia.com/gjrj/800041.html
Using Winscp,putty to write Linux programs under Windows