When running a script remote directory changes to my documents on its own

Advertisement

petersonvince70@gmail.com
Joined:
Posts:
1
Location:
Boise Idaho

When running a script remote directory changes to my documents on its own

Team,
I am working with a very simple script. When I execute the script it keeps trying to change the remote directory to my local documents folder. This only happens on Windows server 2019. I do not have this issue on Windows 10 or Windows Server 2012. Any advice would be most helpful.
-----
winscp Version: 5.17.10

Server: Windows server 2019 standard.

Script:
winscp.com /command "open sftp://xx:xx@xx.net/DEV/IN" "put D:\Files\out\My.csv" "exit" >MyLog.log
Log:
Searching for host...
Connecting to host...
Authenticating...
Using username "xx".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Error changing directory to 'C:\Users\xx\Documents'.
System Error.  Code: 2.

Reply with quote

Advertisement

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

Re: When running a script remote directory changes to my documents on its own

One possible explanation is that you have a stored session called xx:xx@xx.net (or similar) in WinSCP GUI on that machine, which has that directory configured as the default local one.

You should use /ini=nul commandline switch to isolate the script from the configuration to avoid these kind of issues.
See https://winscp.net/eng/docs/scripting#configuration

See also https://winscp.net/eng/docs/faq_environment

If this does not help, please attach a full session log file showing the problem (using the latest version of WinSCP).

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.

Reply with quote

Advertisement

You can post new topics in this forum