@echo off rem assumes we're being run like this: rem %0 ssh://hostname/ rem we strip out the ssh:// part and the trailing slash rem and then send the rest to putty rem Note: we can't handle port numbers or anything after rem the slash appended to the hostname. rem Set this to your putty installation. set PUTTY="C:\Program Files\PuTTY\putty.exe" set URL=%1 if "%URL:~0,6%" == "ssh://" goto ssh if "%URL:~0,6%" == "SSH://" goto ssh echo "Didn't find recognised URL type" pause exit 1 :ssh set HOSTNAME=%URL:~6% goto strip :strip rem strip trailing slash (always appended by shell) if "%HOSTNAME:~-1,1%" == "/" set HOSTNAME=%HOSTNAME:~0,-1% rem now we connect echo Connecting to %HOSTNAME% start "" %PUTTY% %HOSTNAME% %2 %3 %4 %5 %6 %7 %8 %9