blog.plee.me About software, technology and random things

7Sep/170

Open PhpStorm From Windows Explorer Context Menu For Directories

Hello!

If you are a bit lazy like me and just want to simply open PhpStorm from the directory that you've currently navigated to in Windows Explorer, you can use this .reg file to add the registry entries for the entry in the context menu.

Warning: This involves messing around a bit with the registry. Please make sure you understand what you are doing!

This .reg file assumes that the path to your PhpStorm installation is C:\Program Files (x86)\JetBrains\PhpStorm 2017\. If it is not, just search and replace every occurrence of the path in the .reg file with the one that applies for you. Remember to escape backslashes with a backslash!

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\*\shell\Aphpstorm]
[-HKEY_CLASSES_ROOT\Folder\shell\Aphpstorm]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Aphpstorm]

[HKEY_CLASSES_ROOT\*\shell\Aphpstorm]
@="Open Directory in PhpStorm"
"Icon"="C:\\Program Files (x86)\\JetBrains\\PhpStorm 2017\\bin\\phpstorm64.exe"

[HKEY_CLASSES_ROOT\*\shell\Aphpstorm\command]
@="C:\\Program Files (x86)\\JetBrains\\PhpStorm 2017\\bin\\phpstorm64.exe \"%1\""

[HKEY_CLASSES_ROOT\Folder\shell\Aphpstorm]
@="Open Directory in PhpStorm"
"Icon"="C:\\Program Files (x86)\\JetBrains\\PhpStorm 2017\\bin\\phpstorm64.exe"

[HKEY_CLASSES_ROOT\Folder\shell\Aphpstorm\command]
@="C:\\Program Files (x86)\\JetBrains\\PhpStorm 2017\\bin\\phpstorm64.exe \"%1\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\Aphpstorm]
@="Open Directory in PhpStorm"
"Icon"="C:\\Program Files (x86)\\JetBrains\\PhpStorm 2017\\bin\\phpstorm64.exe"
;"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\Aphpstorm\command]
@="C:\\Program Files (x86)\\JetBrains\\PhpStorm 2017\\bin\\phpstorm64.exe \"%V\""

Instructions: Just copy the text into a text file, save it as a file with the .reg extension (e.g. "phpstorm.reg") and execute it via double-click. When asked if you want to continue modifying the registry, confirm with "Yes".

Note: You might wonder why the registry paths contain a segment called "Aphpstorm" instead of "phpstorm" (or anything else). This is so that this entry takes alphabetic precedence over other entries and it is sorted further up. It will not influence the text displayed in the context menu.

Unfortunately I do not know the exact source for this neat little trick because I got this from a colleague at work.

If you wish to revert these changes at some point, just do what the first three instructions in the .reg file do: delete the 3 appropriate keys in the registry.

I hope this is useful to you! It sure is for me.

Thanks for reading!