Command-line parameter in scripting is deprecated

Advertisement

navilor
Joined:
Posts:
10

Command-line parameter in scripting is deprecated

Hello,

I just upgraded to the newest version of WinSCP (WinSCP Version 5.5.3 (Build 4214)) and am now getting the following warning:
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
I went to your history page here:
https://winscp.net/eng/docs/history

When I went there I noticed the following information:
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:
"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:
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:
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:
https://winscp.net/eng/docs/scripting

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

Obviously I missed something in your documentation. Can you please provide a clue for the clueless here?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Command-line parameter in scripting is deprecated

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.

Reply with quote

navilor
Joined:
Posts:
10

Re: Command-line parameter in scripting is deprecated

martin 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.
"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:
https://stackoverflow.com/questions/245395/hidden-features-of-windows-batch-files

Reply with quote

stduser
Guest

Opening session using command-line parameter is deprecated

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

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:


# 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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Opening session using command-line parameter is deprecated

stduser wrote:

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

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""")

Reply with quote

Advertisement

Sakshi
Guest

Re: Command-line parameter in scripting is deprecated

Hello Guys.. I am getting the same message..Command-line parameter in scripting is deprecated.

I have created a batch file for executing the WinSCP.com & a script that transfers the file.
When running the script through CMD manually, it is working fine but when scheduling it through task scheduler it is not running and is showing the message "Command-line parameter in scripting is deprecated."

Also, log file is also not created.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Command-line parameter in scripting is deprecated

Sakshi wrote:

Hello Guys.. I am getting the same message..Command-line parameter in scripting is deprecated.

I have created a batch file for executing the WinSCP.com & a script that transfers the file.
When running the script through CMD manually, it is working fine but when scheduling it through task scheduler it is not running and is showing the message "Command-line parameter in scripting is deprecated."

Also, log file is also not created.
So what is the command-line you are executing in task scheduler? How do you get the error message, if log file is not created?

Also, attach a log file for "running the script through CMD manually".

Ideally start a new thread for your problem.

Reply with quote

Advertisement

You can post new topics in this forum