Batch with params failing

Advertisement

noochi01
Joined:
Posts:
9
Location:
USA

Batch with params failing

Hi All,

I have read, and read, and read, and read, but I just can't figure this out. I created a simple batch script that launches winscp.exe from a batch file, and passes another file to it with code. This works perfectly everytime because it's in the same directory as winscp.exe. The batch file code is: "C:\Program Files (x86)\WinSCP.exe" /console /script=FromFTPServer.txt Like I said, this works perfectly.

When I create a batch file located on my desktop to perform the same action, it fails to execute correctly everytime. My code from my desktop test.bat file is: start "" "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console /script=FromFTPServer.txt

Can anyone help resolve this? I know it's staring me in the face, but I can't get it right!!! :evil: I would also like to add some sort of log file such as /log="C:\Program Files (x86)\WinSCP\winscp.log.txt" but that failed on me as well.

Any help is greatly appreciated!!!!! :lol: :lol: :lol:

Thanks,
Mike

Reply with quote

Advertisement

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

Re: Batch with params failing

Difference may be in a working directory. Try using absolute path to your FromFTPServer.txt.

Regarding the logging: I suppose you are running WinSCP in non-elevated mode, so it won't have write access to C:\Program Files (x86).

Reply with quote

noochi01
Joined:
Posts:
9
Location:
USA

Prikryl,

You are the man. I've seen many responses that you've supplied, and as usual you delivered again. My batch script now works perfectly. Here is the updated code for anyone who needs it..

start "" "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console /script=C:\Users\MYUSERNAME\Desktop\FromFTPServer.txt /log="C:\Users\MYUSERNAME\Desktop\winscplog.txt"

My one additional question is, is there anyway to alter the code above so that it overwrites the log file everytime it runs? Currently it is appending, but I'd rather an overwrite.

Thanks,
Mike

Reply with quote

noochi01
Joined:
Posts:
9
Location:
USA

martin wrote:

noochi01 wrote:

My one additional question is, is there anyway to alter the code above so that it overwrites the log file everytime it runs? Currently it is appending, but I'd rather an overwrite.
There is no command-line parameter for that. You need to configure that in GUI.
https://winscp.net/eng/docs/ui_pref_logging

Thanks Martin! It worked!

Reply with quote

Advertisement

You can post new topics in this forum