Created
December 23, 2014 13:25
-
-
Save teleivo/2eb7dd6afbda414c9269 to your computer and use it in GitHub Desktop.
Run pageant on startup in Cmder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you have a way of getting SSH to work with pageant?