Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shepardm7/4ba27f9597cec43b01395a13c6bd0b4b to your computer and use it in GitHub Desktop.
Save shepardm7/4ba27f9597cec43b01395a13c6bd0b4b to your computer and use it in GitHub Desktop.
Add `Open with IDE` to Windows right click context menu

Source - https://gist.github.com/M1chaelTran/f22ac7c48466e8970f932ab743043e79#gistcomment-3271728
Copy, edit path and IDE name and save the below code as a ".bat" file and run it as an administrator

To add the Context Menu:

@echo off

:: Needs to be run as administrator.
:: Change the paths below to match the desired IDE.
:: Make sure you don't quote any of the paths in following lines, spaces are allowed.
SET LaunchPath=C:\Users\MyUser\AppData\Local\JetBrains\Scripts\pycharm.cmd
SET IconPath=C:\Users\MyUser\AppData\Local\JetBrains\Scripts\icons\pycharm.ico
SET AppName=PyCharm
 
echo Adding file entries
@reg add "HKEY_CLASSES_ROOT\*\shell\%AppName%" /t REG_SZ /v "" /d "Edit with %AppName%"   /f
@reg add "HKEY_CLASSES_ROOT\*\shell\%AppName%" /t REG_EXPAND_SZ /v "Icon" /d "%IconPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\%AppName%\command" /t REG_SZ /v "" /d "%LaunchPath% \"%%1\"" /f
 
echo Adding within a folder entries
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\%AppName%" /t REG_SZ /v "" /d "Open with %AppName%"   /f
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\%AppName%" /t REG_EXPAND_SZ /v "Icon" /d "%IconPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\%AppName%\command" /t REG_SZ /v "" /d "%LaunchPath% \"%%V\"" /f

echo Adding folder entries
@reg add "HKEY_CLASSES_ROOT\Directory\shell\%AppName%" /t REG_SZ /v "" /d "Open with %AppName%"   /f
@reg add "HKEY_CLASSES_ROOT\Directory\shell\%AppName%" /t REG_EXPAND_SZ /v "Icon" /d "%IconPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\Directory\shell\%AppName%\command" /t REG_SZ /v "" /d "%LaunchPath% \"%%1\"" /f

pause

To remove the Context Menu:

@echo off

:: Needs to be run as administrator.
:: Make sure you don't quote the name, spaces are allowed.
SET AppName=PyCharm
 
echo Deleting file entries
@reg delete "HKEY_CLASSES_ROOT\*\shell\%AppName%"
 
echo Deleting within a folder entries
@reg delete "HKEY_CLASSES_ROOT\Directory\Background\shell\%AppName%"

echo Deleting folder entries
@reg delete "HKEY_CLASSES_ROOT\Directory\shell\%AppName%"

pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment