Cmd.exe has the SET command that lists the all "%" constants, for example %USERNAME% , %ProgramFiles% or %CUSTOMDEFINEDCONSTANT%. However, after issuing the START firefox my browser immediately popped up, although neither firefox nor %firefox% had been mentioned!

Why there are two types of constants? For me, "Program's constant"(that I've rough-and-readily called it) seems to be redundant so far because START %programName% would be sufficient, doesn't it? I'm also asking about the counterpart of the SET command for this strange constants' type.

The question is elementary, but I decided to ask about it here due to the lack of a search coordinates or keywords.

  • Those are Environment Variables. Also search for PATH, that is also an environment variable and explain why you can do START firefox. – fmanco Jul 21 '12 at 20:41
  • @criziot PATH | FINDSTR firefox yields no results. – 0x6B6F77616C74 Jul 21 '12 at 20:44
  • PATH has a list of directories containing binaries. When you try to execute a binary cmd will search for it in the directories specified in PATH. So firefox is not in PATH, but the directory containing the firefox binary must be. Also you should do echo $PATH to see the PATH. – fmanco Jul 21 '12 at 21:08
  • > Also you should do echo $PATH to see the PATH. You’re thinking of PowerShell; the OP is using cmd where there is actually a command called path that displays or sets the path. – Synetech Jul 21 '12 at 21:32
  • @Synetech I'm not a Windows user so I wasn't aware of that. Thanks for the repair. – fmanco Jul 22 '12 at 1:42

I believe that, among other things, it looks in this registry key for the executable name:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

This key allows an application to register itself for execution without modifying the PATH variable. MSDN has more information about application registration.

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.