justinmassiot
7/11/2018 - 12:41 PM

Auto-load keys into Pageant

@echo off

set pageant_path=..\..\.putty\pageant.exe
REM Add the program to your system path if you want it te be accessible globally
set sshkeys_path=..\..\.ssh
REM Use keys with no passphrase if you don't want to be prompted each time.

REM Start Pageant alone without waiting for it to return
start %pageant_path%

timeout 5

REM Load all the keys into Pageant.
REM %%~na is the file name without extension and %%~xa is the file extension
for /f %%a in ('dir %sshkeys_path% /b') do (
  if /i %%~xa==.ppk (
    echo Loading the following key into Pageant:  %%a
    cmd /c %pageant_path% %sshkeys_path%\%%a
  )
)