Post a reply

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

Please attach a full session log file showing the problem (using the latest version of WinSCP).

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.
integrator

Batch file

Hello,

It's not transferring the .csv file from my PC (Client) to the remote server when I run the batch command.

When I open WinSCP and look at the administrator screen it shows that we connect just never sent the file.

THanks
martin

Re: Batch file

Sorry, "isn't working" isn't working as problem description. What problem do you have?
All I can see in your post is that you are missing a space here:
    "put ""C:\Users\smith\Documents\519M-SCH\Test csv files\Monday\*.*"" ""C:\Temp\*.*"""^
integrator

Batch file

Good day and happy holiday.

I'm using WinSCP as a client sending a .csv file to an SFTP server. I can do it manual and would like to create a batch file to automatically do it via Windows Task Schedule. I've used the WinSCP to create the batch but am having a hard time to figure out how to do the actual batch file transfer.
This is what I have that isn't working.
Basically from what I understand, the put is sending down the file located on my PC (Client) to the server.
C:\Users\smith\Documents\519M-SCH\Test csv files\Monday*.* – this is the location of the folder which contains the file.
C:\Temp\*.* – this is the folder on the server which I want to send the .csv file too.

Thanks for any light on this
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://UserNet:password1@100.600.602.24/ -hostkey=""ssh-ed25519 255 RYGpLKoNOadAyIIR671Botp3yYNa45od7YzkhHHip4AY""" ^
    "put""C:\Users\smith\Documents\519M-SCH\Test csv files\Monday\*.*"" ""C:\Temp\*.*"""^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)