Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] The Basics of Creating Your Own Shell Extensions
#1
The Basics of Creating Your Own Shell Extensions
A Guide by Nemmyy Thumbsupyyyy



First off, I'd like to thank Infinity for inspiring me to teach myself how to do this and to create this tutorial, along with his thread: [Video Tutorial] How to add Cmd Prompt to Context Menu (Right-Click)

If you think this is too advanced for you, or you don't want to take the time to do this, then I have included a few registry files at the bottom of the tutorial. All you have to do is download and run them.


What Will This Tutorial Teach Me?

This thread will just go over the very basics.
I am going to be showing you how to create a registry file with the .reg extension. These files automatically edit your registry when run, instead of having to manually edit things. If you want to learn how to manually edit your registry to add your own shell extension, then look at Infinity's guide linked above.


What Are Shell Extensions?

Shell extensions appear in your Context Menu, which is what pops up when you right-click on either a file or a folder. The most commons shell extensions that Windows already has installed are basic things like "Open" and "Properties". Some programs you install add their own shell extensions, like your Anti Virus program. If you have an AV program installed and you right click on something you'll most likely have an option that says "Scan with (AV name here)". That is a shell extension.


How Do I Create Registry Files and Access the Registry?

To create a registry file all you have to do is open up Notepad, type in the information you want to be added to your registry, and then save the file using whatever name you want, with a .reg file extension. To do this, under "Save as type" select "All Files" and then type .reg above, after your file name.
Saving a registry file: (Click to View)

To access the registry you can either hit the 'Start' button and search for 'regedit' or navigate to C:\Windows and run 'regedit.exe'.


Step 1: Backing Up the Registry

Back up your registry! This step is very important. If you mess up your registry then your whole computer can be ruined. To back up your registry open up regedit.exe. Then, right click on the folder you want to back up and click 'Export'. Choose a file location and a file name and you're all set. It should only be necessary to back up the registry folders you're editing, like 'HKEY_CLASSES_ROOT\*' instead of the whole 'HKEY_CLASSES_ROOT' folder.


The Rest of the Tutorial

We'll be looking at a registry file that creates a shell extension which opens the selected file in Photoshop. This shell extension appears on any file you right-click.
Open with Photoshop: (Click to View)

The whole registry file is below and I will explain each part individually.
Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Photoshop]
@="Open with Photoshop"

[HKEY_CLASSES_ROOT\*\shell\Photoshop\command]
@="\"C:\\Program Files\\Adobe\\Adobe Photoshop CS5 (64 Bit)\\Photoshop.exe\" \"%1\""

First off, you have to include 'Windows Registry Editor Version 5.00' at the top of your registry file or else Windows won't know what to do when you run it.

Now I will talk about the first block of code:
Code:
[HKEY_CLASSES_ROOT\*\shell\Photoshop]
@="Open with Photoshop"

[HKEY_CLASSES_ROOT\*\shell\Photoshop] is a path in your registry and determines on what kinds of files your shell extension will appear. I put my Photoshop shell extension in 'HKEY_CLASSES_ROOT\*\'. The '*' indicates any file type. So when I install this shell extension, I can right click on any file and have the option to open it with Photoshop. '\shell\Photoshop' indicates that I am adding to every file type's shell, and the name of the folder I am creating which will contain this shell extension is "Photoshop". If you only wanted your shell extension to appear on jpeg images, then you could edit the directory like this: [HKEY_CLASSES_ROOT\jpegfile\shell\Photoshop]
The folder name 'Photoshop' can be put to whatever you want, such as 'Open with Photoshop'.

If you want a shell extension to appear in the Context Menu only on folders, then you can use the following directory: [HKEY_CLASSES_ROOT\folder\shell]

'[color=#DDA0DD]@="Open with Photoshop"
' adds a name to your shell extension while in the Context Menu. If I right click on a file I will see an option that says 'Open with Photoshop'. If you want your option to just say 'Photoshop' or something like that, then you can edit the code to say: @="Photoshop"


Here is the second block of code:
Code:
[HKEY_CLASSES_ROOT\*\shell\Photoshop\command]
@="\"C:\\Program Files\\Adobe\\Adobe Photoshop CS5 (64 Bit)\\Photoshop.exe\" \"%1\""

[HKEY_CLASSES_ROOT\*\shell\Photoshop\command] is a path in your registry where the command of your shell extension is stored. The directory needs to be the same as where you created the first folder, with the addition of the command folder.

'@="\"C:\\Program Files\\Adobe\\Adobe Photoshop CS5 (64 Bit)\\Photoshop.exe\" \"%1\""' is the command itself. This is what will be executed when you click on your shell extension in the Context Menu. The command has to be formatted this way. If you're running a 32 bit version of Photoshop then your command will should look like this: @="\"C:\\Program Files\\Adobe\\Adobe Photoshop CS5\\Photoshop.exe\" \"%1\""
Now say you're writing a different shell extension entirely. You'll need to change the path of the executable, but keep the format the same. For example, if you wanted to open something with Daemon Tools Lite using the Context Menu, then your command would look like this if you're using a 64 bit operating sytem: @="\"C:\\Program Files (x86)\\DAEMON Tools Lite\\DTLite.exe\" \"%1\""


Deleting Folders: Manually and with Registry Files

To manually delete a folder, all you have to do is open up the registry (regedit.exe) and navigate the folder you want to delete. If you want to delete 'HKEY_CLASSES_ROOT\*\shell\Photoshop' then find the folder and either click on it and press the 'delete' key or right click on and and select 'delete'.

To delete a folder with a registry file, all you have to do is edit the registry file you used to create the folder. The code should look like this:
Code:
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\*\shell\Photoshop]

Just put the location of the folder you want to delete with a dash before everything inside the brackets.


Downloads:

Open with Photoshop CS5 64 bit.reg
Open with Photoshop CS5 32 bit.reg
Open Command Window Here.reg


Hopefully this guide was helpful.
Comments, suggestions, and thanks are much appreciated.
If you want to request any shell extensions or if you have any questions, feel free to ask.
Reply
#2
garbage. nerd. kill yourself
I don't splel check.
Reply
#3
(04-06-2011, 05:42 AM)Scalise Wrote: garbage. nerd. kill yourself

Yeye
Reply
#4
(04-06-2011, 05:46 AM)Nemmyy Wrote: Yeye

I'd probably try this but I have nothing I have to extend to. And when are you adding how to get rid of them? That's more useful for me lol. Thumbsup
I don't splel check.
Reply
#5
(04-06-2011, 11:53 AM)Scalise Wrote: I'd probably try this but I have nothing I have to extend to. And when are you adding how to get rid of them? That's more useful for me lol. Thumbsup

Open with Photoshop is probably one of the most useful ones out there. This is just the very basics, but you can make it do many other things. Basically any command line.

You should back up your registry before doing anything, I'll add that and how to remove folders from your registry.
Reply
#6
Very interesting, going to take the time to follow this.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [TuToRiAl] Change Command Prompt Text Color [TuToRiAl] Resistance 63 28,561 01-22-2013, 09:48 PM
Last Post: Resistance
  [TuToRiAl][ReAd Me] Introducing Windows's Best Friend, Taskkill [ReAd Me][TuToRiAl] Resistance 2 2,609 04-19-2011, 06:25 AM
Last Post: Spectrum

Forum Jump:


Users browsing this thread: 1 Guest(s)