Opening smb:// links on windows

Thanks DavidPostill for pointing me into the right direction. Here is what I did:

Registry file (smb.reg):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\smb]
"URL Protocol"=""
@="URL:SMB Protocol"

[HKEY_CLASSES_ROOT\smb\DefaultIcon]
@="explorer.exe,1"

[HKEY_CLASSES_ROOT\smb\shell]
[HKEY_CLASSES_ROOT\smb\shell\open]
[HKEY_CLASSES_ROOT\smb\shell\open\command]
@="\"C:\\OpenLink\\openLink.bat\" \"%1\""

Batch file (openLink.bat):

@echo off
set str=%1
set str=%str:smb:=%
set str=%str:/=\%
explorer.exe %str%

And it works great. :)


If your SMB links contain spaces, you can use the following improved batch script in Eskel's answer:

@echo off

set str=%1
set str=%str:smb:=%
set str=%str:/=\%

setlocal EnableDelayedExpansion
set str=!str:%%20= !

rem echo %str% & pause

explorer.exe %str%