Post a reply

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)


Topic review


Re: WINSCP Batch file error pushing file to SFTP

Can you upload the file in WinSCP GUI? Or in any other SFTP client? If you can, please post a log file showing that.

And also attach a full session log file from your WinSCP script.

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

WINSCP Batch file error pushing file to SFTP

First - Not a programmer by any means, however, I have been able to grab a file via WINSCP SFTP to a third party server/system. I was then asked to create the same by pushing a file. AS in the working case I created a Batch file to call a text file to pull the file in. after some serious tweaking, I got this to work.

Now in the new scenario, I re-created the same batch/text file and added the needed commands based on what I read and this is creating and error that I cannot resolve. I know the directory has the necessary permissions as I can perform the task manually without issue via WINSCP. I am guessing it is the code - not sure - HELP!



@echo off
REM Next line NOT needed if you add the WinSCP folder to your Windows
REM PATH environment variable
CD "C:\Program Files (x86)\WinSCP" /script=C:\Scripts\SFTP_FILENAME.txt



option echo off
option batch on
option confirm off
open s
put -delete -nopreservetime -nopermissions E:\SFTP_Test\*.pdf /*


See attached for error -