Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top