Putty command line options

Advertisement

Y-Phil
Joined:
Posts:
5

Putty command line options

Hi

Once again: thank you for that awesome program.

Here is a situation I am confronted to almost every day. I use WinSCP (even trough a double-tunnel) to do some remote editing. Then comes the time to test. Ctrl-P launches an instance of Putty. Everything works fine...
Almost. Something that would help me would be the ability to add a string that serves as additional command-line options used when launching Putty, string stored in each WinSCP session. These string could for example keep some settings such as "-L80:localhost:80 -L5432:localhost:5432" and thus be used by putty when it starts.
I have tried to store only a few settings in Putty but it looks like it's actually unable to load a partial profile form the registry.

Thus, this would come in rather handy.

Thanks in advance.
Y-Phil.

Reply with quote

Advertisement

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

Re: Putty command line options

You can make a script/batch file that takes a host name as an argument and produces specific switch on its output. Then use !`command` pattern in PuTTY path to make use of that script. Use !@ pattern to pass a host name to the script. Use of !@ unfortunately comes at cost that WinSCP does not create temp site in PuTTY anymore. So you will need to explicitly pass a username using !U pattern and you cannot pass other specific parameters.

Example:
%PROGRAMFILES%\PuTTY\putty.exe !`C:\path\portforward.bat !@` !U@!@

Where portforward.bat is like:

@echo off
if "%1" == "example.com" echo -L80:localhost:80 -L5432:localhost:5432

See
https://winscp.net/eng/docs/ui_pref_integration_app

Reply with quote

Advertisement

You can post new topics in this forum