Created
March 12, 2010 11:20
-
-
Save mattn/330238 to your computer and use it in GitHub Desktop.
windowsではssh-askpassが使えないのでsetxで環境変数に設定しちゃうぞバッチファイル
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 | |
if "%1" == "-f" goto doit | |
if "%1" == "-s" goto session | |
if not "%SSH_AGENT_PID%" == "" goto end | |
goto doit | |
:session | |
for /f "eol=; tokens=1,2 delims==;" %%1 in ('ssh-agent.exe') do ( | |
if "%%1" == "SSH_AUTH_SOCK" setx SSH_AUTH_SOCK %%2 & set SSH_AUTH_SOCK=%%2 | |
if "%%1" == "SSH_AGENT_PID" setx SSH_AGENT_PID %%2 & set SSH_AGENT_PID=%%2 | |
) | |
goto bottom | |
:doit | |
for /f "eol=; tokens=1,2 delims==;" %%1 in ('ssh-agent.exe') do ( | |
if "%%1" == "SSH_AUTH_SOCK" set SSH_AUTH_SOCK=%%2 | |
if "%%1" == "SSH_AGENT_PID" set SSH_AGENT_PID=%%2 | |
) | |
:bottom | |
ssh-add | |
:end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment