Topic "Batch with params failing"

Author Message
noochi01
[View user's profile]

Joined: 2013-12-20
Posts: 9
Location: USA
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 or Very Mad 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!!!!! Laughing Laughing Laughing

Thanks,
Mike
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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).
_________________
Martin Prikryl
noochi01
[View user's profile]

Joined: 2013-12-20
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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
_________________
Martin Prikryl
noochi01
[View user's profile]

Joined: 2013-12-20
Posts: 9
Location: USA
prikryl 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!
Advertisements

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License