BAT File SFTP Scripting Issue

Advertisement

rsmiley
Joined:
Posts:
3
Location:
Pittsburgh

BAT File SFTP Scripting Issue

Hello. I have a scripting issue that has worked for a year and suddenly stopped working after the provider changed the password. Once I updated the password I can no longer connect to there server and upload a file. I am not a expert in script writing and now I need some help.
Take a look and see what is wrong.

I know it's not the remote server because I can open up WinSCP and put in the credentials and I get connected.

echo off
echo option batch abort > ftpcmd.dat
echo option confirm off >> ftpcmd.dat
echo open sftp://username:password@secureNAME.Name.com -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx">> ftpcmd.dat
echo put \\servername\e$\Folder1\Folder2\Folder3\Folder4\Test-4-3-18-TEST.txt >> ftpcmd.dat
echo exit>> ftpcmd.dat
"C:\Program Files (x86)\WinSCP\winscp.com" /script=ftpcmd.dat
del ftpcmd.dat

Thanks

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,123
Location:
Prague, Czechia

Re: BAT File SFTP Scripting Issue

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

To generate the session log file, use /log=path_to_log_file 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.

Reply with quote

rsmiley
Joined:
Posts:
3
Location:
Pittsburgh

Thanks Martin.

Unfortunately, I am not a scripting expert at all. So I have no idea how to write that into the bat file. The bat file that included, where would I place line to get it to generate the logfile. Also, When I run the bat file I noticed that it gets stuck on the password part of it.

I have attached that for you to see. I know its not the logfile but thats all I have until you help me with the log command.

Thanks
Rob
  • WINSCP.JPG (18.4 KB, Private file)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,123
Location:
Prague, Czechia

"C:\Program Files (x86)\WinSCP\winscp.com" /script=ftpcmd.dat /log=C:\some\path\ftpcmd.log

Reply with quote

rsmiley
Joined:
Posts:
3
Location:
Pittsburgh

Thanks Martin. I got it to work. I have attached part of the output. It looks like it is hanging on the password but I can't tell if the script is wrong on my side or from the remote server side for accepting it.

Rob
  • WINSCP-Log.JPG (82.2 KB, Private file)

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum