Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: It worked

There's no specific type. So .txt would be the best as it does not impose any specific format (whereas .ini does).
artanyis

It worked

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.
martin

Re: Help with Outputlog for mixed scripting

You need to use winscp.com (not winscp.exe) and redirect its output to a file:
https://winscp.net/eng/docs/executables

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

You may also consider using session logging:
https://winscp.net/eng/docs/logging

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

Help with Outputlog for mixed scripting

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:

open User:Pass@Server.location.com
option confirm off
get RootDir:/folder/file D:\OurFolder\SubFolder\
get RootDir:/folder/file2 D:\OurFolder\SubFolder\
exit

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 User:Pass@Server.location.com
Searching for host...
Connecting to host...
Authenticating...
Using username "User".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] User:Pass@Server.location.com
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.