opening session.... is deprecated

Advertisement

michaewlewis
Guest

opening session.... is deprecated

I've been using a script to download a daily file from a server for several years and recently had to change to a new server that holds my file in a different directory. I changed the location in the script, but now I get a couple of new errors in the log (custom built log to echo everything the script does into a text file) which says:
"Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Error occurred during logging. It's been turned off."

Here's the part of the script which I use to run WinSCP:
%WinSCP% %profile% /log="%log%" /command "option batch on" "get -delete %remotedir%*.jdb %localdir%" exit

Which runs as:
"C:\Program Files (x86)\WinSCP\winscp.com" SISSVRUTIL02 /log="D:\Scripts\AVDefsDLLog.txt" /command "option batch on" "get -delete /*.jdb D:\VirusDefs\Temp\" exit



Any idea what could be causing this error?
Thanks.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,542
Location:
Prague, Czechia

Re: opening session.... is deprecated

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

The command-line format you are using was never really allowed and definitely not recommended, you should do:

%WinSCP% /log="%log%" /command "option batch on" "open %profile%" "get -delete %remotedir%*.jdb %localdir%" exit

Error occurred during logging. It's been turned off.
There should be more details about the error following the above line.
Anyway, I assume the path to the log file is not valid or is not writable.
_________________
Martin Prikryl

Reply with quote

michaewlewis
Guest

Thanks for the tip. That fixed it.
The problem with the log error was that I was using the batch file to write other information to the log file. It's acting as though the log file was locked for the batch file's usage and the WinSCP log function couldn't access it because of that. So, now I'm writing a log file for each process.

Thanks for your help!

Reply with quote

moko2
Guest

"Command-line parameter in scripting is deprecated"

Simply want to open the winscp site using a script. The script contains:
open sftp://usernameremoved.passwordremoved@example.com/

Yet when the script run, the host is searched for and does not appear.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,542
Location:
Prague, Czechia

Re: "Command-line parameter in scripting is deprecated"

moko2 wrote:

Simply want to open the winscp site using a script. The script contains:
open sftp://usernameremoved.passwordremoved@example.com/

Yet when the script run, the host is searched for and does not appear.

I assume you use wrong syntax of WinSCP command-line, making WinSCP use some random part of the syntax as a host name.
Please read scripting and command-line documentation properly:
https://winscp.net/eng/docs/guide_automation

If that does not help, please start a new thread and attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, use /log=path_to_log_file 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.

Reply with quote

Advertisement

You can post new topics in this forum