"Global Commands" are determined by your environment variables.
Depending on which OS you are using getting to it to set it is rather different.
The most generic way is by
Right-Click "My Computer"
Select "Properties"
In Windows7 you will have to select "Advanced System Settings" in the pane on the left.
Once you have the System Properties dialog open, Select the "Advanced" tab.
At the bottom, there is a button "Environment Variables"
In the Environment Variables Dialog, you will be able to configure environmental variables per user or for the entire system.
For example, the System Variable "Path" simplified would look something like this...
C:\Program Files\Java\jre6\bin;C:\Ruby19\bin;
Executables in these paths can be called directly from Command Line.
The reason you can call calc, mspaint, cmd all from the Run Dialog is because C:\windows\system32 is in the Path environment variable.
You may add custom paths into the environmental variables, careful not to override the existing one and to separate the paths using a semi-colon. ";"
You can then run an executable from that path directly in command line without typing out the entire path, like the java -version command.
For more reading please see the following links...
Environment Variables
Understand and Configure Environment Variables
2
See here.
– Daniel Beck – 2012-01-09T15:44:34.023I don't have the details at hand at the moment which is why this is a comment and not an answer, but if
java.exe
(orjava.com
, etc) is not in yourPATH
there is another registry entry that can specify executable paths. – Mark Hurd – 2012-01-09T16:59:37.2301@MarkHurd cmd (and CreateProcess) doesn't examine the App Paths registry entry, only ShellExecute [and therefore the Run dialog] does. – Random832 – 2012-01-09T21:21:31.253
@MarkHurd, as you've expected, it's not in my path variable.. – Pacerier – 2012-01-09T22:13:45.010
1@Pacerier The java executable is found in %SystemRoot%\System32\ – Dwayne Hinterlang – 2012-01-09T22:24:44.357
@DwayneHinterlang Ic, this is weird.. shouldn't it be the java.exe in %programfiles%\java\jre7\bin ? – Pacerier – 2012-01-09T22:45:01.243
@Pacerier I have a new install of JRE 8, where java.exe is found in multiple folders, must be a java thing. :S Included a snap shot for convenience. – Dwayne Hinterlang – 2012-01-09T22:55:45.173
And that's why
which
is really convenient on any Unix/Linux system. – Daniel Beck – 2012-01-09T23:03:40.340@DanielBeck i'm lost.. what do you mean? – Pacerier – 2012-01-10T00:36:02.643
Well, what does it do? It tells you which instance of the program gets executed when you type the program name. Instant answer to your edited question. – Daniel Beck – 2012-01-10T05:16:59.090
@Random832: I didn't see your comment until after I confirmed it my self, but you're right
App Paths
are not checked bycmd
. – Mark Hurd – 2012-01-10T06:10:14.823@MarkHurd so do u mean that if
java.exe
is not in the path, its not possible for anything to run? – Pacerier – 2012-01-10T06:53:13.877@Pacerier: Yes, if
java.exe
is not in one of the directories ofPATH
, and not in the current directory, then typingjava.exe
on the command line ofcmd
should return'java.exe' is not recognized as an internal or external command, operable program or batch file.
– Mark Hurd – 2012-01-12T06:30:34.677