Topic "Help with Outputlog for mixed scripting"

Author Message


I need help figuring out how to add in an output log for a mixed script.
This is a "Simple" automation to basically pass files from a 3rd party SFTP to a 3rd party software on my clients server. There are several other things going on in the collection of scheduled scripts but what I need help with is getting WinSCP to print the output of the .ini to a log file.

Here is what's inside the .ini:

option confirm off
get RootDir:/folder/file D:\OurFolder\SubFolder\
get RootDir:/folder/file2 D:\OurFolder\SubFolder\

The .ini is run from a batch file, here's the line that runs the .ini:

D:\OurFolder\winscp\winscp.exe /script=D:\OurFolder\Get-Files.ini

There are actually 2 other .ini files, but this is the important one. That's all WinSCP does in this series of scripts. I would like to know if there is a way that I can make it so that it prints everything out to a log?

When I run the commands manually I get:

winscp> open
Searching for host...
Connecting to host...
Using username "User".
Authenticating with pre-entered password.
Starting the session...
Reading remote directory...
Session started.
Active session: [1]
winscp> get RootDir:/folder/file D:\OurFolder\SubFolder\
file | 0 B | 0.0 KiB/s | binary | 0%
winscp> get RootDir:/folder/file2 D:\OurFolder\SubFolder\
file2 | 0 B | 0.0 KiB/s | binary | 0%
winscp> exit

If i can get it to dump that same information in a log file, I'll be golden.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25549
Location: Prague, Czechia
You need to use (not winscp.exe) and redirect its output to a file:

D:\OurFolder\winscp\ /script=D:\OurFolder\Get-Files.ini > D:\OurFolder\output.txt

You may also consider using session logging:

Note that you should not name WinSCP scripts .ini. They are not INI configuration files.


That is exactly what I was looking for, thank you. I had tried using > to print the results before but it either did absolutely nothing or threw an error, "too many parameters," depending where I used it. Thanks for noticing I needed .com instead of .exe

If not an .ini, is there a particular file type that is recommended? Since .ini is just a plain text configuration format, it made it easy for me to differentiate between the WinSCP scripts, the windows batch scripts, the windows Pwershell scripts and the XML task triggers.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25549
Location: Prague, Czechia
There's no specific type. So .txt would be the best as it does not impose any specific format (whereas .ini does).

You can post new topics in this forum

Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License