Skip to content

Instantly share code, notes, and snippets.

@teleivo
Created December 23, 2014 13:25
Show Gist options
  • Save teleivo/2eb7dd6afbda414c9269 to your computer and use it in GitHub Desktop.
Save teleivo/2eb7dd6afbda414c9269 to your computer and use it in GitHub Desktop.
Run pageant on startup in Cmder
@echo off
setlocal ENABLEDELAYEDEXPANSION
set ssh_key_home=%HOME%\.ssh\
set pageant_key_wildcard=*.ppk
echo start pageant and add keys matching %pageant_key_wildcard% from^
%ssh_key_home%
rem Check if pageant is running
for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq PAGEANT.EXE" /fo csv') do (
set pageant_pid=%%F
)
rem Start pageant in background
if "%pageant_pid%" == "" (start pageant.exe)
rem Get pageant style keys
for /f "tokens=*" %%I in ('DIR /B "%ssh_key_home%%pageant_key_wildcard%"') do (
echo add key "%ssh_key_home%%%%I"
pageant "%ssh_key_home%%%I"
)
endlocal
@echo on
@twig
Copy link

twig commented Oct 26, 2015

Do you have a way of getting SSH to work with pageant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment