PuTTY Config to Disk

After many hours of googling and combining multiple solutions, I came up with a fairly easy way to keep your PuTTY config to disk.  The method used only writes the config to disk if it has changed since the last use, keeping erase-write cycles to a minimum (good for use on a flash disk).

1) Create a .bat file in the same directory as putty.exe

2) Contents of the .bat file:

SET ttyRnd=%TEMP%\puttyrnd.tmp
SET ttyDel=%TEMP%\puttydel.tmp
SET ttyReg=%TEMP%\puttyreg.tmp

ECHO [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]>>%ttyRnd%
ECHO “RandSeedFile”=”%TEMP:\=\\%\\putty.rnd”>>%ttyRnd%
regedit /s %ttyRnd%
DEL %ttyRnd%
SET ttyRnd=

regedit /s putty.ini
start /w putty.exe
regedit /ea %ttyReg% HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
fc putty.ini %ttyReg% | find “FC: no dif” > NUL
IF ERRORLEVEL 1 COPY %ttyReg% putty.ini
del %ttyReg%
SET ttyReg=

ECHO [-HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]>>%ttyDel%
type %ttyDel%
regedit /s %ttyDel%
del %ttyDel%
SET ttyDel=

3) To execute PuTTY, run the .bat file you just created and enjoy!

As you can see, the settings are still written to registry, but a local copy is stored and the registry cleared upon each use.  Let me know what you think!

Leave a Reply