Unable to get 'put' script to work

Advertisement

dubscat01
Joined:
Posts:
1

Unable to get 'put' script to work

Hello, and thanks in advance -

WinSCP version: 5.5.2 (build 4130)
Windows 2010
Protocol: FTP

I am trying to upload a .txt file, and I've templated a script off the example posted here:
VBA/Shell script not working for large files

The script generates the following strShell string:
"C:\Program Files (x86)\WinSCP\WinSCP.exe" userID:password@host.url "put \\local drive\local folder\FTP_Upload_Test.txt /ftp path folder/sub-folder/" "close"
Which I execute with:
Shell strShell
Problems:
  1. I've set up the host login with the userID and password that I'm assigning in the strShell string, and can login manually with no problem; however when I execute the shell command, it initially follows the same login sequence, but then says "Access denied" and then asks for the pw to be entered again.
  2. Re-entering the pw does allow the login to proceed successfully, but the file transfer does not occur

Reply with quote

Advertisement

Guest

Re: Unable to get 'put' script to work

Thank you for your response, martin -

Ok, I've tried using both a .txt file (example.txt) and invoking
winscp.exe /console /script=example.txt
and, as above, using shell strShell. I've reviewed the documentation as you mention, as well as the related examples, but still am simply unable to get it figured out. What/where, specifically, is my syntax wrong?

Thanks again.

Reply with quote

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

Re: Unable to get 'put' script to work

  • You are missing /command parameter before the commands.
  • You are missing open command.
  • Your paths with spaces are not enclosed in double-quotes.
  • You are missing (almost mandatory) option batch abort and option confirm off commands. (EDIT: not needed in the latest version of WinSCP anymore)
Using /script= is definitely better for you as the syntax in script file is simpler than on command line.
You probably want to avoid /console (after you finish debugging this) to avoid console window popping up.

Reply with quote

Guest

Re: Unable to get 'put' script to work

Thanks again, martin -

Ok, have reviewed again the documentation and tried to implement your suggestions (which I did see in the doc'n/examples). My strShell now is:
C:\Program Files (x86)\WinSCP\WinSCP.exe /command "option batch abort" "option confirm off" "open userID:password@xx.xx.xxxx" "put \\localDrive\localFolder\FTP_Upload_Test.txt /Monthly Reporting/2014/3-2014/" "exit"
as suggested, but this does not connect at all, now. I've also tried inserting /console, and all possible iterations using c:\...\WinSCP.com without success.... May I ask, what should the exact string be? Also, I'm not sure I understand the "paths with spaces" comment; have not seen double quotes around the files paths in any of the examples, else I'm misunderstanding (likely!).

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum