Post a reply

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)


Topic review


Re: open command not working in script, but works in console.

Please attach a full session log files from both tests.

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.

open command not working in script, but works in console.

I am on a Windows 10 Pro machine:
I cd to WinSCP directory and type in the following command:

> /script=C:\Users\artr\Documents\ReceiveTEST.txt

The script contains the following code:

option echo on
option batch on
option confirm on
open TESTTran/myTest
put -nopermissions -nopreservetime *.DAT

I get the Host prompt twice and then it exits the script, as follows:

echo on
option batch on
batch on
reconnecttime 120
option confirm on
confirm on

However when I type in the WinSCP command:

I am able to execute the open command as it is in the script directly:
winscp> open TESTTran/myTest
Searching for host...
Connecting to host...
Using username "xxxxxx".
Authenticating with public key "xxxxxx".
Starting the session...
Session started.
Active session: [1] TESTTran/myTest

I am then able to execute the other commands in the script.

Why is the script not working?