Topic "How to switch local directory from comand line (batch)"

Author Message
InGearX

Guest


I am able to specify the remote directory

Code:
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 Wink

Thank you all...
Advertisements
InGearX

Guest


nothing yet?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Setting local directory from command line is not supported. You can set it in stored session.
User

Guest


prikryl 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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
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.
_________________
Martin Prikryl
thecotne
[View user's profile]

Joined: 2015-01-21
Posts: 3
Location: Tbilisi, Georgia
prikryl 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/
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
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).

Quote:
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.
thecotne
[View user's profile]

Joined: 2015-01-21
Posts: 3
Location: Tbilisi, Georgia
after executing command i want GUI to be opened

but this command
Code:
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)
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
That's correct. The /console switch is for opening console window.
See http://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
http://winscp.net/eng/docs/commandline
http://winscp.net/eng/docs/rawsettings

Last edited by martin on 2015-04-10; edited 1 time in total
thecotne
[View user's profile]

Joined: 2015-01-21
Posts: 3
Location: Tbilisi, Georgia
actually you have wrong syntax correct is
Code:
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Thanks. I've corrected my answer.
_________________
Martin Prikryl
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