3

Is it possible to load PuTTY connection information (session) from file?

Not from registry, not from command line, but from file?

I would like to have a file per each remote computer and open it with PuTTY so that it connects automatically.

Something like:

putty -load myfile.connection

UPDATE

putty user@host:port will not load multiple parameters, like encoding, colors, etc

While putty -load "session name" will take data from the registry

I wish to read data from file.

3
  • 1
    Putty cannot load session information FROM FILE. The best you can do is load registry information FROM FILE and then tell PuTTY to load session information FROM REGISTRY. You can have a file per each remote computer that makes putty connect automatically but the file must load settings INTO REGISTRY.
    – qasdfdsaq
    Aug 27, 2015 at 12:42
  • According to one of the documentation which I've fount, if you connect directly, without profile load, the default settings will be used, so if you have the same color settings you can set it in the default profile and it should work the connection with your colors. Currently no possibility to load from file. Feb 20, 2019 at 14:55
  • Would this be the answer you are looking for? kb.norsetech.net/how-to-make-putty-automatically-load-a-session Jun 22, 2021 at 7:24

2 Answers 2

5

You can create a .reg file with all the settings:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions\MySession]
"HostName"="example.com"
"Colour0"="187,187,187"
...

Import the settings using the reg command:

reg import MySession.reg 

And then load the imported settings using the -load switch of PuTTY:

putty.exe -load MySession

If you want, you can have the key deleted using the reg delete after starting PuTTY.

A complete batch file would be:

@echo off
reg import MySession.reg 
start putty.exe -load MySession
timeout /t 2
reg delete HKCU\SOFTWARE\SimonTatham\PuTTY\Sessions\mysession /f

(The two-second timeout is there to let the PuTTY load the settings before it gets deleted).


And of course there are loads of PuTTY clones that support configuration INI files. For example KiTTY.


Another option is to make use of WinSCP that can open PuTTY from a session specified on WinSCP command-line:

winscp.exe ssh://[email protected]/

While WinSCP allows much wider set of options on its command-line, it does not support terminal-specific options, like colors.

(I'm the author of WinSCP)

2

Sorta, "putty user@host:port" or Putty -load “session name” or (3rd party tools) you might want to check out http://remotedesktopmanager.com/

more CLI stuff http://etherealmind.com/putty-command-line/

if you want password-less login generate a private key and use pageant.

2
  • putty user@host:port will not load multiple parameters, like encoding, colors, etc; while putty -load "session name" will take data from the registry; I wish to read data FROM FILE
    – Dims
    Aug 27, 2015 at 12:27
  • Here you go, extraputty.com/features/storage.html Aug 27, 2015 at 12:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .