문제

I have a WinSCP code written for some file transfer ... That's working fine.

My requirement is: before I exit from WinSCP console, I want to execute another batch to take a screenshot of that WinSCP console and then I want to say bye to the WinSCP console. But as long as the second operation is not complete, I don't want to exit the WinSCP console.

I tried:

winscp> Call %some_path%\test.bat

but it says some error like:

enter image description here

도움이 되었습니까?

해결책

The call command executes the command on the server.

You cannot execute local commands from WinSCP script.

But you can execute WinSCP from a batch file and take a screenshot from the batch after WinSCP finishes. Make sure that you execute the winscp.com (not the winscp.exe). The winscp.com is a console application. It inherits the console of the parent batch, so you do not loose WinSCP output after it finishes.

winscp.com /script.txt
%some_path%\test.bat

Anyway, I do not really understand the purpose of this. Wouldn't it be better, if you redirect the output of the winscp.com to a log file?

winscp.com /script=script.txt > output.txt

Or maybe even better, use a log file (the /log=<path> command line parameter). The log includes whole output of the WinSCP console, and lot more.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top