Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Re: pass new folder/directory name on cmdline for stored session

Thanks for your post. This request is being tracked already.

pass new folder/directory name on cmdline for stored session

I am running ver 4.2.7 on WinXPSP3. I am submitting this as feature request because I cannot find a way to do this after studying the documentation and running numerous tests.

I want to open WinSCP.exe (GUI) to a saved session, but to a different folder than the session default, by passing a command line parameter for different folder. For instance, say I have a saved session called 'mysession' which includes pwd, and which has a default directory of /home/myfolder.

When I execute this cmd line:

WinSCP.exe mysession

it opens to the default directory for that saved session (/home/myfolder'). However, say I want to open a different folder, e.g. '/home/myfolder/subfolder/'. I would like to pass this different folder along with the saved session name on the cmdline, like this:

winscp.exe mysession /home/myfolder/subfolder/

I have tried to make this work, but it does not appear to be possible, hence the feature request.

I realize I can save a separate stored sessions for the same server, each with it's own default folder. However, when I change my server pwd, I need to change the saved pwd for each and every stored session to that server. I might have several if I have to save a separate session for each folder. I would be much easier to have a single saved session and be able to pass the folder path on the cmdline.

What I want is to have a single saved session then be able to open to different folders for this session by passing a cmd line parameters. I realize this can be done by invoking a new session on cmdline:

winscp.exe [(sftp|ftp|scp)://][user[:password]@]host[:port][/path/[file]]

but this means I have to script my user:pwd whenever I call this. What I want is to use a stored session and just pass the folder on the cmdline, overriding any default folder saved in that stored_session.

I did think of one way to do it. I use an INI file, so I could parse/filter a copy of the INI, change the remote directory parameter for the relevant session, then pass that batch-edited INI filespec to WinSCP.exe on the cmdline. This works, but it would be much easier to just pass the directory on cmdline with the saved session name.