PuTTY is one of those indispensable little programs that I take with me everywhere I go. I used to just run it off my USB flash drive, and type in the host name on each different computer that I ran it on. This got very tedious, very quickly. I wanted to be able to take my host definitions (which are stored in the registry) with me, too, and I didn't want to leave a bunch of junk on every computer I used. After a bit of looking, I found information in the PuTTY documentation about putting the configuration settings into a file. This seemed lacking to me since I never knew what drive letter would be assigned to my thumb drive and I didn't want to edit the batch file every time. So, I fixed it ...
Now, when I run the batch file, it sets the path for the .rnd file to whatever drive\directory the batch file is in.
The only other change I had to make to get it working was a modification of the puttyrnd.reg file. I simply stripped the last line out of the file and renamed it puttyrnd.tmp. I then create the puttyrnd.reg file within my batch file.
Here is a listing of all of the used files:
@echo off :: Set MyPath with proper escaping for entry into the registry set MyPath=%CD:\=\\%\\putty.rnd :: Add the site definitions into the registry regedit /s putty.reg :: Build the puttyrnd.reg file so that it uses the current dir and add it to the registry type puttyrnd.tmp > puttyrnd.reg echo "RandSeedFile"="%MyPath%" >> puttyrnd.reg regedit /s puttyrnd.reg :: Run Putty (and wait for it to end) start /w putty.exe :: Export the new site definitions in case something changed regedit /ea new.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY :: Put the new definitions into the putty.reg file copy new.reg putty.reg del new.reg :: Delete everything out of the registry regedit /s puttydel.reg
If you would like to download a zip file with all of these files plus PuTTY you can get it by going to Portable PuTTY in the online documents.
Of course, you need to generate the putty.reg file that contains all your site definitions before you run the batch file. You can build the file by typing the following at the command line:regedit /ea putty.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
Hopefully this helps someone as much as it has me ...