For example, if I click txt file from explorer a notepad window shows up, but when I open 'menu start'->run->cmd.exe and then type txt file name also notepad gets in my way. Can I set it to be two different applications in these situations?

The same for PHP or other script files, I would like Windows to open the editor when double click in explorer, but run in the interpreter when called from keyboard in cmd shell.

I found that, for a given extension, the [HKEY_CLASSES_ROOT\php_auto_file\shell\open\command] registry hive contains the path to the program that executes files of php extension, but it affects both explorer and shell.

  • not sure, but you may be able to get double click to open in the interpreter, and "execution" in cmd to too. But to open in notepad, right click and click edit. – barlop Aug 6 '11 at 5:59
  • With plain text there is not much annoyance. It gets in the way if cmd shell is full screen it must go out of it to run graphical application. But there could be serious issue with clicking, you could accidentally click a script that would do bad things. Of course it should be then accessible only as right-click mouse option, but in shell the main command is identical with double click in explorer. – rsk82 Aug 6 '11 at 6:12
  • Is it too much work to add the executable in front of the filename? I.e. "notepad.exe filename.php" to open with notepad, and "php5 c:\filename.php". – David Chen Aug 6 '11 at 8:08
  • 1
    In this single case not. But with many extensions and with scripts it makes sense. Second: computers were invented to ease us of such repetitive task. Being lazy is good. – rsk82 Aug 6 '11 at 9:19

You can register multiple open commands with each file association.


Use this program to add multiple commands to a file type's right click menu.

  • Yes but as I wrote the default right click menu option is the same as the command whet you put c:\>my_file.txt in the console, it makes no sense to open editor when you are in the console and is a security risk to associate double click with running script in explorer. – rsk82 Aug 6 '11 at 9:15
  • 1
    Second thing. This program needs .Net 3.5 which is a huge bloated thing, most apps are pleased with 2.0 or 4.0, 3.5 is worst of them all. – rsk82 Aug 6 '11 at 9:18
  • 1
    Registry Keys to the rescue. There is a registry key that dictates which command Explorer chooses as its default. Now to hunt it down. – surfasb Aug 6 '11 at 9:53
  • I agree with the security risks. I ended up writing a GUI that organizes and launches my scattered list of BAT, VBS, PW1, PL. Oh I long for the days of when all you needed to know was one or two languages (C). – surfasb Aug 6 '11 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.