copy openFolder.bat to C:\shellScripts
Run the folder-open-reg.reg this will add the necessary keys
The url should look like
folderopen:C:\Users
| Windows Registry Editor Version 5.00 | |
| [HKEY_CLASSES_ROOT\folderopen] | |
| "URL Protocol"="" | |
| @="URL:folderopen" | |
| [HKEY_CLASSES_ROOT\folderopen\shell] | |
| [HKEY_CLASSES_ROOT\folderopen\shell\open] | |
| [HKEY_CLASSES_ROOT\folderopen\shell\open\command] | |
| @="\"C:\\shellScripts\\openFolder.bat\" \"%1\"" |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Folder open test</title> | |
| </head> | |
| <body> | |
| <a href="folderopen:C:\Users\">Open Folder</a> | |
| </body> | |
| </html> |
| @echo off | |
| setlocal enabledelayedexpansion | |
| rem Step 1: Extract the folder path by removing the "folderopen:" prefix | |
| set "input=%*" | |
| set "folderPath=%input:folderopen:=%" | |
| rem Step 2: URL Decode the folder path | |
| rem Replace %5C with \ | |
| set "decodedPath=%folderPath%" | |
| set "decodedPath=!decodedPath:%%5C=\!%" | |
| start "" !decodedPath! | |
| endlocal |