Topic "/script not firing"

Author Message
lbrewerton

Guest


I have a Windows CMD file -

Code:
@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:-

Code:
# 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.
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
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
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
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
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

Quote:
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.
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License