How to switch local directory from comand line (batch)

Advertisement

InGearX
Guest

How to switch local directory from comand line (batch)

I am able to specify the remote directory

start winscp380.exe sftp://user51:pass@wwwstage.nydc.site2.prv:22/usr/local/www/staging/

But I wish I could specify the local directory it should open as well - C:\+PROJECTS+\+PROJECT_A+\SITEA.COM\PRODUCTION\...

Any idea how?

Any tips, tricks, links, suggestions are much appreciated ;)

Thank you all...

Reply with quote

Advertisement

User
Guest

Re: no one?

martin wrote:

Setting local directory from command line is not supported. You can set it in stored session.

Um...the stored session is not changing to the local directory set in the GUI (using version 4.1.6). The local directory automatically loads fine using the GUI, but not through scripting.

I have a saved session with the local and remote directory set. My settings are being saved in a winscp.ini file and the session information looks correct.

...in stored session...
LocalDirectory=C:\temp (in winscp.ini it's C:%5Ctemp)
RemoteDirectory=/remotefolder

...from command prompt...
W:\winscp.com
winscp> open user@sessiondotcom
winscp> pwd
/remotefolder
winscp> lpwd
W:\

I needed to use lcd to change the local, so when I use the synchronize command in a script I'm using the correct directories.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: no one?

User wrote:

Um...the stored session is not changing to the local directory set in the GUI (using version 4.1.6). The local directory automatically loads fine using the GUI, but not through scripting.
You haven't mentioned you are using scripting.

You can do:
(edited)
winscp.exe /console /command "open sftp://user51:pass@wwwstage.nydc.site2.prv:22/usr/local/www/staging/" "lcd c:\temp"
Last edited by martin on 2015-01-23; edited 1 time in total

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: no one?

User wrote:

Um...the stored session is not changing to the local directory set in the GUI (using version 4.1.6). The local directory automatically loads fine using the GUI, but not through scripting.
This issue has been added to tracker.

Reply with quote

thecotne
Joined:
Posts:
4
Location:
Tbilisi, Georgia

Re: no one?

martin wrote:

User wrote:

Um...the stored session is not changing to the local directory set in the GUI (using version 4.1.6). The local directory automatically loads fine using the GUI, but not through scripting.
You haven't mentioned you are using scripting.

You can do:
(edited)
winscp.exe /console /command "open sftp://user51:pass@wwwstage.nydc.site2.prv:22/usr/local/www/staging/" "lcd c:\temp"

hello

actually that command does not work lcd is not executed
and i need to open GUI that command opens command line interface
i am developing sublime text integration of winscp https://github.com/thecotne/sublime-WinSCP/

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: no one?

thecotne wrote:

actually that command does not work lcd is not executed
It works for me. Please show us a complete command-line, a console screenshot and a log file.
Also note that I have edited the command-line, because the original form is not recommended anymore (though it still works).

and i need to open GUI that command opens command line interface
I do not understand, what you mean by "open GUI that command opens command line interface". Please try to explain.

Reply with quote

thecotne
Joined:
Posts:
4
Location:
Tbilisi, Georgia

after executing command i want GUI to be opened

but this command
winscp.exe /console /command "open sftp://user51:pass@wwwstage.nydc.site2.prv:22/usr/local/www/staging/" "lcd c:\temp"
opens command prompt (command line interface)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

That's correct. The /console switch is for opening console window.
See https://winscp.net/eng/docs/commandline#scripting

If you want to open GUI, use:
winscp.exe sftp://user51:pass@wwwstage.nydc.site2.prv:22/usr/local/www/staging/ /rawsettings LocalDirectory=c:\temp

See
https://winscp.net/eng/docs/commandline
https://winscp.net/eng/docs/rawsettings
Last edited by martin on 2015-04-10; edited 1 time in total

Reply with quote

thecotne
Joined:
Posts:
4
Location:
Tbilisi, Georgia

thx

actually you have wrong syntax correct is
winscp.exe sftp://user51:pass@wwwstage.nydc.site2.prv:22/usr/local/www/staging/ /rawsettings LocalDirectory=c:\temp

it does not work without equal sign

Reply with quote

Advertisement

You can post new topics in this forum