See also WinSCP script not executing in batch file. So you either have to save the commands (open to exit) to a WinSCP script file (say script.txt) and execute the script using the /script switch: Call Shell ("C:\path\winscp.com /ini=nul /script=c:\path\script.txt") Alternatively, specify all commands on WinSCP command line, using the /command. To execute WinSCP commands in a batch file, you need to use /script or /command switches. With /script switch, you need to move your WinSCP commands into a separate text file, e.g. script.txt: open sftp://user:[email protected]/ put d:\examplefile.txt exit And execute it from the batch file like: echo Starting WinSCP winscp.com /script =script.txt /log =winscp.log. Jan 25, 2020 · The first line of the script is automatically generated by WinSCP, and the rest are common documented options and scripting commands.