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

Guest

Hi,

I call WinSCP from a batch file, and in the batch file I explicitly log a line with date/time.

The batch file is like this:
echo %date% %time% ##### foo.cmd: Starting a cool winscp job >> L:\logs\job.log
winscp.com /privatekey=foo.ppk /script=script.txt >> L:\logs\job.log
martin

Re: Script Automation with logging

This is not a log file. It's the console output.

Only now I've noticed that you use a wrong syntax of the command-line. The >> should not be there. Use:
"C:\Program Files (x86)\WinSCP\winscp.com" /log=logfile.log /script="xxxxxxx"
Quinsy

Re: Script Automation with logging

I will post an example:
Searching for host...

Connecting to host...
Authenticating...
Using username "xxxxx".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] xxxxxxxxxx
/Outgoing
C:\xxxxxxxxxxx
test2.txt                 |            0 B |    0,0 KiB/s | binary |   0%
C:\xxxxxxxx
test2.txt                 |            0 B |    0,0 KiB/s | binary |   0%
Session 'xxxxxxxx' closed.
No session.
Searching for host...
Connecting to host...
Authenticating...
Using username "xxxx".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] xxxxxxx
/Outgoing
C:\xxxxxxxxx
test2.txt                 |            0 B |    0,0 KiB/s | binary |   0%
C:\xxxxxxxxxxxxxxxx
test2.txt                 |            0 B |    0,0 KiB/s | binary |   0%
Session 'xxxxxxx' closed.
No session.

Here I used the Script twice, but there is no time and or date between the different connections.

If you understand now?

And yes I do want it to just update the same logfile.
martin

Re: Script Automation with logging

I do not understand the question. Every entry in the log file has a timestamp.
Quinsy

Script Automation with logging

Hey.

I'm trying to set the script to log what files getting copied over.

This is my command:
"C:\Program Files (x86)\WinSCP\winscp.com" /log=>>logfile.log /script="xxxxxxx"

My question is how to i get the log file to add time and date for the copy between each sessions, right now they all end up underneath each other with no timestamp.
I want to know when the copy was done.
Do I add /t or something, and where to I add it?