Skip to content

Instantly share code, notes, and snippets.

@BrandonStudio
Last active November 11, 2023 20:35
Show Gist options
  • Save BrandonStudio/d56b97d4d1e186ddce355d418e29bbb1 to your computer and use it in GitHub Desktop.
Save BrandonStudio/d56b97d4d1e186ddce355d418e29bbb1 to your computer and use it in GitHub Desktop.
VLC URL protocol handler for "vlc://" links on Windows
@echo off
echo Waiting for UAC...
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c ""%~0"" ::","","runas",1)(window.close)&&exit
set /p vbspath=Please enter the path of vlc-protocol.vbs with double quotation mark (e.g. "C:\Program Files\VideoLAN\VLC\vlc-protocol.vbs"):
set command=wscript \"%vbspath:~1,-1%\" %%1
reg.exe add HKCR\vlc /ve /d "URL:VLC"
reg.exe add HKCR\vlc /v "URL Protocol"
reg.exe add HKCR\vlc\shell\open\command /ve /d "%command%"
echo Done!
pause
set args = WScript.Arguments
dim vlc
vlc = """C:\Program Files\VideoLAN\VLC\vlc.exe""" ' NOTE: replace this value with your own
dim path
if args.count > 0 then
dim url
url = args(0)
url = mid(url, 7)
path = vlc & " " & url
else
path = vlc
end if
wscript.createObject("wscript.shell").run path, 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment