/script not firing

Advertisement

lbrewerton
Guest

/script not firing

I have a Windows CMD file -

@echo off
start "C:\Program Files (x86)\WinSCP\WinSCP.exe" /script=C:\HyveSync\Automation\KBStaffSync.txt /xmllog=C:\HyveSync\Automation\log.txt

The script file is this:-

# Automatically abort script on errors
option batch continue
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using stored connection
sftp://KBStaff

# Force binary mode transfer
option transfer binary
 
synchronize remote C:\Tomcat\Websites\Shared\staffwiki /kbstaff
 
# Disconnect
close
exit

But when I fire the CMD file either by using the shortcut or from command line, nothing seems to happen and my log file is empty, but if I use the WinSCP console and copy/paste the commands from the script file into the WinSCP console then it works fine.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

Re: /script not firing

Your code cannot work in any way. This is just wrong: sftp://KBStaff. You probably wanted open sftp://KBStaff. But still, you are missing credentials.
https://winscp.net/eng/docs/scriptcommand_open
https://winscp.net/eng/docs/session_url

And you should use the winscp.com, at least for debugging. With winscp.exe you cannot see the errors.
https://winscp.net/eng/docs/executables

Reply with quote

lbrewerton
Guest

This is using a stored connection so connection details should not be necessary?

When I use winscp.com I get a "no mapping for the unicode character exists in the target multibyte code page" error

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

lbrewerton wrote:

This is using a stored connection so connection details should not be necessary?
But you still need the open command.
And using stored sites in the script is not recommended:
https://winscp.net/eng/docs/scripting#configuration

When I use winscp.com I get a "no mapping for the unicode character exists in the target multibyte code page" error
Make sure the script uses UTF-8 encoding.

Reply with quote

Advertisement

You can post new topics in this forum