Skip to content

Instantly share code, notes, and snippets.

@spraints
Created March 18, 2010 15:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spraints/336483 to your computer and use it in GitHub Desktop.
Save spraints/336483 to your computer and use it in GitHub Desktop.
Creates registry entries for a saved putty session with a window 80x40 and the ssh agent forwarded.
@echo off
setlocal
set alias=%1
set host=%2
set user=%3
if "" == "%alias%" goto :help
if "" == "%host%" set host=%alias%
if "" == "%user%" set user=%USERNAME%
rem echo Host: %host%
rem echo User: %user%
set prompt=-
set key=HKCU\Software\SimonTatham\PuTTY\Sessions\%alias%
call :setkey UserName %user% REG_SZ
call :setkey HostName %host% REG_SZ
call :setkey AgentFwd 1 REG_DWORD
call :setkey TermWidth 0x0050 REG_DWORD
call :setkey TermHeight 0x002c REG_DWORD
rem reg query %key%
goto :eof
:setkey
@echo on
reg add %key% /v %1 /d %2 /t %3 /f
@echo off
goto :eof
:help
echo Usage: %0 putty-alias [hostname [username]]
echo hostname will default to the aliased name
echo username will default to %USERNAME%
@reg query HKCU\Software\SimonTatham\PuTTY\Sessions /s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment