Skip to content

Instantly share code, notes, and snippets.

@fareedfauzi
Last active December 29, 2019 04:37
Show Gist options
  • Save fareedfauzi/76150bdf91057910b5c97ced22418e0c to your computer and use it in GitHub Desktop.
Save fareedfauzi/76150bdf91057910b5c97ced22418e0c to your computer and use it in GitHub Desktop.
Batch file to make a program can be "Open with" when we right click on it.
@echo off
echo ====================================================
echo Example of usage... :)
echo Enter executable path: C:\Program Files\HxD\HxD.exe
echo Enter your program's name: HxD
echo ====================================================
echo.
set /p exepath=Enter executable path:
set /p programName=Enter your program's name:
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with %programName%" /t REG_SZ /v "" /d "Open with %programName%" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with %programName%" /t REG_EXPAND_SZ /v "Icon" /d "%exepath%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with %programName%\command" /t REG_SZ /v "" /d "%exepath% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with %programName%" /t REG_SZ /v "" /d "Open with %programName%" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with %programName%" /t REG_EXPAND_SZ /v "Icon" /d "%exepath%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with %programName%" /t REG_SZ /v "" /d "%exepath% \"%%1\"" /f
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment