Just as a Note to my self or anybody who is interested in it, feel free to use.

Often you come across hrefs linking to ssh://user@whatever:22 by default Windows do not know what to do with this Protocol, if you go to select the Standard Protocol Handler for it you only got redirected to the MS Store offering you some Expensive Terminal Apps you actually do not want to use. I for my self using the Pro Version of MobaXterm since many Years. MobaXterm have a shell integration but I never got it running right or beeing selectable als Protocol Handler - unfortunately. But this is why I made this little Method to actually make it working.

What you need to have: A SSH Programm like Putty or MobaXterm or whatever you use. My example now is totally optimized for MobaXterm but the principle is the same for every other SSH Client, you just need to ajust the Batch file according.
 

1. Create a Batchfile

Use a Folder where it can stay permanently, e.g. your MobaXterm ssh Settings folder, name it e.g. ssh_handler.cmd and put this into it:
 
@echo off
REM Simple SSH Link Protocol Handler for Win10
REM Can be used with Mobaxterm or easy adaopted to any other ssh client
REM Public Domain feel free to use.
REM https://tcpip.wtf
REM -MG-
SETLOCAL
rem //removing ssh:// from call
SET TARGETHOST=%1 
SET T2=%TARGETHOST:~6,-2%
rem searching Mobaxterm location
SET EXEC="%ProgramFiles%\Mobatek\MobaXterm\MobaXterm.exe"
IF EXIST %EXEC% GOTO CONNECT
SET EXEC="%ProgramFiles(x86)%\Mobatek\MobaXterm\MobaXterm.exe"
IF EXIST %EXEC% GOTO CONNECT
SET EXEC="%appdata%\Mobatek\MobaXterm\MobaXterm.exe"
IF EXIST %EXEC% GOTO CONNECT
echo MobaXterm EXE Not Found...
GOTO END

:CONNECT
echo Connecting to: %T2%
start "%T2%" %EXEC% -newtab "ssh -AC %T2%"

:END

2. Create a .reg file

This is just temprary to tell Windows about the new Protocol Handler. Name it whatever you like e.g. custom-ssh-handler.reg and put this in:
 
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ssh]
@="URL: ssh Protocol"
"URL Protocol"=""

;Change this to your actual path of the previous generated Batch File
[HKEY_CLASSES_ROOT\ssh_custom_handler\shell\open\command]
@="C:\\your\\permanent\\path\\ssh_handler.cmd %1"

[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"SSH Custom handler"="Software\\Classes\\ssh_custom_handler\\Capabilities"

[HKEY_CLASSES_ROOT\ssh_custom_handler\Capabilities\UrlAssociations]
"ssh"="ssh_custom_handler"

;You can use any ICO File or just using mobaxterms Icon
[HKEY_CLASSES_ROOT\ssh_custom_handler\Application]
"ApplicationIcon"="\"C:\\Program Files (x86)\\Mobatek\\MobaXterm\\MobaXterm.exe\""
"ApplicationName"="Custom SSH Handler"
"ApplicationDescription"="Custom SSH Handler"
"ApplicationCompany"="Custom SSH Handler"

Before you save it please change the Path to your previous generated Batchfile. After saving double click it and Agree to add it to the Registry. Now the Registry need to reload, the simplest way is to either reboot your PC or Logout your Account and relogin. After this you need to Open the Win10 Settings for Default Programs, just Press the WIN Key and Type default. If you scroll down on that Dialog you will find the Option "Choose default Apps by Protocol" open it and scroll down to SSH, here you now should find the Custom Protocol Handler we just created.

Example Screenshot of my german Win10:


✉ MG// CEST

Follow Icon
Don’t miss out and subscribe by email:
Don't worry! NO Spam and FREE; Receive a summarizing email for new posts, easy to unsubscribe at any time.
← Other Blog Posts