Topic "Command-line parameter in scripting is deprecated"

Author Message
navilor
[View user's profile]

Joined: 2009-11-01
Posts: 10
Hello,

I just upgraded to the newest version of WinSCP (WinSCP Version 5.5.3 (Build 4214)) and am now getting the following warning:
Code:
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.

I went to your history page here:
http://winscp.net/eng/docs/history

When I went there I noticed the following information:
Code:
Before opening session using command-line parameter in scripting, warning is printed, that this is deprecated function.

I apologize but that doesn't make sense for me right now. I hope that you can provide clarification.

My setup is as follows:
1) I have a batch file that has the following inside of it:
Code:
"C:\Program Files (x86)\WinSCP\winscp.com" /script="C:\Users\kevin\Desktop\Utils\winscpbatchfile.txt" /log=C:\Users\Kevin\Desktop\Utils\FreeNASSyncLogs\FreeNAS-%date:~-4,4%-%date:~4,2%-%date:~-7,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%-%time:~9,2%.log

2) The "winscpbatchfile.txt" that is used above has the following in it:
Code:
open sftp://usernameremoved:passwordremoved@freenas

option batch continue
option transfer binary
option confirm off

I then have multiple sections in the text file to back up specific locations on my multiple hard drives. Below is just one:
Code:
lcd "C:\Users\kevin\Documents"
cd /mnt/share/kevin/users/kevin/Documents
synchronize remote -mirror -delete -nopreservetime -filemask=|"*.tmp; C:\Users\kevin\Documents\My Music\; C:\Users\kevin\Documents\My Pictures\; C:\Users\kevin\Documents\My Videos\;"

I did not notice any changes on this page:
http://winscp.net/eng/docs/scripting

Or this page:
http://winscp.net/eng/docs/commandline

Obviously I missed something in your documentation. Can you please provide a clue for the clueless here?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Your winscp.com command line should generally not produce this warning.

Unless your %date% and %time% magic is wrong and resolve in some parts to a string with spaces. I cannot verify this as I do not know in what locale you run the command. Note that %date% and %time% are locale-specific, so may not be reliable.

If this does not help, please attach your log file.
_________________
Martin Prikryl
navilor
[View user's profile]

Joined: 2009-11-01
Posts: 10
prikryl wrote:
Unless your %date% and %time% magic is wrong and resolve in some parts to a string with spaces.

That it is. Thank you for the pointer on that. Putting the log file and path in quotes resolved the issue.
Code:
"C:\Users\Kevin\Desktop\Utils\FreeNASSyncLogs\FreeNAS-%date:~-4,4%-%date:~4,2%-%date:~7,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%-%time:~9,2%.log"

This was a problem that had plagued me for a while which appeared to be random in nature. The problem was that a space was added in one or more of the time sections. This happens as my instance of Windows 7 64bit will always use "short time" on the command line. I have yet to find a way to force "long time" out on the command line even when parsing this thread:
http://stackoverflow.com/questions/245395/hidden-features-of-windows-batch-files
stduser

Guest


Hi, I am having the same issue with WinSCP 5.4.4, with the VBA shell command

Code:

Call Shell("C:\Program Files (x86)\WinSCP\winscp.com / script = ""C:\Users\xxxxxx\Documents\Test Library\ConnectCell13.txt"" ")


I get the message "Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead."

The script is pretty simple:


Code:

# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off

# Force binary mode transfer
option transfer binary

open scp://user:passwd@cell13

cd /SPARE_DISK/datalog

get LibrChgLogCell13access.csv

# Exit WinSCP
exit


I don't think I could have the option of upgrading the WinSCP version.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
stduser wrote:
Hi, I am having the same issue with WinSCP 5.4.4, with the VBA shell command

Code:

Call Shell("C:\Program Files (x86)\WinSCP\winscp.com / script = ""C:\Users\xxxxxx\Documents\Test Library\ConnectCell13.txt"" ")

You have spacing and quoting all wrong. It should be:

Call Shell("""C:\Program Files (x86)\WinSCP\winscp.com"" /script=""C:\Users\xxxxxx\Documents\Test Library\ConnectCell13.txt""")
Advertisements

You can post new topics in this forum






Search Site

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