Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

martin

Re: batch file script

OK, you have another problem in your batch file. I believe it's quite obvious. You didn't replace the placeholder C:\writable\path\to\log\ with an actual path. So WinSCP tries to log to a folder that does not exist. Use a real path.

If this still does not help, please post your new complete script/batch file. A log file can be useful too.

Also make sure you have read complete article I've linked above. It deals with common problems people have when using WinSCP from a batch file:
https://winscp.net/eng/docs/faq_batch_file
bw5500@hotmail.com

batch file script

Thank you, unfortunately both examples return same error, "The system cannot find the file specified". The file can be moved manually however the file is not found when written to a batch file. Please advise, as this is the WinSCP is the first software i have ever had issues with integrating to a batch file for a scheduled task. having to use the WinSCP due to sftp hostkey requirements.
bw5500@hotmail.com

Re: Batch file script

see attached screen snip with error highlighted, please advise.
bw5500@hotmail.com

https://winscp.net/eng/docs/guide_automation is exactly reason I'm asking as the doc's are rather hard to follow compared to any other software I have used. not sure why above code i posted shows as guest did it either. please help. thank you.
Guest

batch file script

The script generator has "Your command 1" and "Your command 2" , but doesnt seem to work, so either im not using correct syntax for WinSCP, or I have the script in the wrong position. see below, please advise.

@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://abc@123.server.transfer.us-west-2.xyz.com/ -hostkey=""ssh-rsa 1234 abc123="" -privatekey=""\\server.abc.network\Data\FILE_SHARE\me\ABC.ppk""" ^
    "GET abc.txt "F:\def\"" ^
    "Your command 2" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%
martin

Re: Batch file script

Without any details of what you have tried, I can only point to a generic guide:
https://winscp.net/eng/docs/guide_automation
If you need more specific help, please show us your attempts. And describe what problems you have with them.
bw5500@hotmail.com

Batch file script

Trying to insert a get command into a batch file, however between the syntax and the help screens this WinSCP is like no other to figure out. Need to get from an SFTP and pull to a local. Generated the transfer code in the GUI but inserting the additional command is not working. please advise.