Opening smb:// links on windows
Is there any way to make Windows (10 preferably) explorer to open smb protocol URI? Like smb://1.2.3.4/file.txt
I'm in a diverse environment of operating systems (mostly windows, mac and linux) and also web services we're using (slack, youtrack) but all our files are sitting on a server with samba share and it's hard to have clickable links that all can access.
We have two options for unification:
- The Windows way -
file://X:/
- The Unix way? -
smb://1.2.3.4/
I've found it's easier to use the smb links with web tools, slack recognizes them, mac and linux open them fine, it's just that windows are refusing to recognize the protocol, although the address itself works.
Solution 1:
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. :)
Solution 2:
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%