Skip to content

Adding actions such as command prompts to the right click menu

It is handy sometimes to be able to open a command prompt in Windows in a specific directory, especially if you’re writing scripts you just want to run from the command line.

For command prompts it’s easy, as there is a Power Toy called DOSHere[.inf]. But really it’s all about the registry.

Luckily (well, somewhat) you can also do this from Explorer, and it comes in handy for older programs which tend to launch always in whatever directory they are in (or rather the “Start in” folder as defined in the shortcut). One such very useful program is this file renamer. Unlike most programs of this type, I’ve yet to run into a combination of actions I needed to perform that this thing couldn’t do (when it came to renaming files, anyway).

But it was annoying to be looking at the directory containing the files I wanted to rename and having this guy start in its own directory.

You can add a right-click menu item for a program like this easily. Warning: I’ve had my computer hiccup with this done before. In Explorer, go to Tools->Folder Options… and select the File Types tab. After the flashlight gets out of your way, look for a file type called “File Folder”, which should be near the top. Select it, and hit the Advanced button.

Now here’s the kicker: you can create new actions and set a default, but you can’t delete or edit them without manually doing so in the Registry. So, type slow.

Hit the New… button. “Action:” is the text to appear in the menu, and the other text box is the command line to the application. There are some parameters you can type in to pass arguments to programs, but most of the time (or at least for the purposes of having a program start in a particular directory) you don’t need that stuff—but here it is anyway. In the case of both the command prompt (cmd.exe) and the file renamer I mention here, all you need is the path to the executable (I put the full path in just to be safe).

Again, remember to be careful how you type because you can’t change it unless you go into the Registry.

Presumably you can also do this with the “Folder” file type, but you shouldn’t need both. I don’t know what the difference is between the two other than “File Folder” is referred to as “Directory” inside the registry.

After I did this the first time at home I had a problem where suddenly after rebooting when I double-clicked on a directory it would open a new window instead of using the same one, and this was regardless of the option set in the General tab of the Folder Options dialog. Some searching on the internet yielded a Registry snippet corresponding to the original unaltered folder-actions, so I had to delete that entire key in my Registry and merge in this new one. Unfortunately I can’t remember where that is or where I searched for it (which is part of the reason I started this blog).

At my computers at work I added the exact same actions and nothing bad ever happend, except today I pressed enter while having 17 PDF’s selected in a window and it opened 17 instances of 7-Zip.

At home I think my computer is just drunk because in iTunes if I tell it to show me the file a Windows dialog box asking how I want to handle the file type opens up every time, and no matter what I do, after about 5 seconds an explorer window opens with the file shown… I guess it’s time for a fresh clean reinstall (see below). I have it down to about 30 minutes these days.

Post a Comment

Your email is never published nor shared. Required fields are marked *