(Putty) Pageant autoload private key

If you are remotely connecting to your linux desktop using putty and you want to avoid typing your password then pageant is your answer however pageant has a memory of a gold fish. It cannot remember your private key once you have exited from the application. So to get pageant to remember, here is a little trick.

Lets say your private keys are located at “C:\putty\cert”, create a batch file autoloader.cmd and add the following lines

— start here —

if exist "C:\putty\cert\your-linux1.ppk" (set KEYS="C:\putty\cert\your-linux1.ppk")

if exist "C:\putty\cert\your-linux2.ppk" (set KEYS=%KEYS% "C:\putty\cert\your-linux2.ppk")

if not defined KEYS exit
start /d"c:\putty" pageant.exe %KEYS%

— end here —