error 141 can't open log file

Advertisement

mreinsmith
Joined:
Posts:
3

error 141 can't open log file

I run a batch file with the following command

C:\Progra~2\WinSCP\winscp.exe /console /script=transfer.txt /xmllog=transfer.log /nointeractiveinput

it runs the script 'transfer.txt' as shown here

option batch on
option confirm off
option transfer ascii
open sftp://root:password1@server1 -hostkey=*
lcd V:\test
cd /remote1
mput *.xml
cd /remote2
mput *.xml

open sftp://root:password2@server2 -hostkey=*
cd /remote1
mput *.xml
cd /remote2
mput *.xml

open sftp://root:password3@server3 -hostkey=*
cd /remote1
mput *.xml
cd /remote2
mput *.xml

open sftp://root:password4@server4 -hostkey=*
cd /remote1
mput *.xml
cd /remote2
mput *.xml

it correctly logs the result for "server1" but after it connects to server2 i get the error "141 can't open log file 'transfer.log'

the log then is written to V:\test (the local directory shown above) and server2 logs correctly to that copy.

from there, SERVER3 and SERVER4 don't get logged anywhere

any ideas how to correct this behaivor?

Thank You

M

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: error 141 can't open log file

I cannot reproduce your problem with any version of WinSCP. What version are you using?

Anyway, it's not a good idea to log all sessions into one file (one would overwrite the other). Consider using some session-specific pattern in the log path. E.g. !S:
C:\Progra~2\WinSCP\winscp.exe /console /script=transfer_!S.txt /xmllog=transfer.log /nointeractiveinput

See https://winscp.net/eng/docs/ui_pref_logging#session_log

Reply with quote

mreinsmith
Joined:
Posts:
3

I used the following to activate the script

C:\Progra~2\WinSCP\winscp.exe /console /script=transfer.txt /xmllog=%USERPROFILE%\Desktop\transfer_!S.log /nointeractiveinput

it creates 4 separate logs, but at least I can easily verify the results

Thanks for your help

M

Reply with quote

Advertisement

You can post new topics in this forum