-2

How the windows start command found application path I means when I use start firefox.exe how Windows know where is firefox.exe, is there simple way to found absolute path only with application name ? I know the environment variables path & others, I searched in all of them and I not found firefox.exe and other programs.

Another thing some programs can be launched directly from cmd without start like iexplorer or notepad but not all the programs regardless the cwd path.

Michael
  • 416
  • 1
  • 6
  • 16
  • google for PATH environment variable – Iłya Bursov May 10 '16 at 21:29
  • Really you're Firefox.exe is in you're path not in my path every application not necessarily in path – Michael May 10 '16 at 21:31
  • In addition to the `PATH` variable it also searches your current directory. – Mark Ransom May 10 '16 at 21:40
  • Yeah I know but you can try in every directory it will work – Michael May 10 '16 at 21:42
  • As far as I know, the `PATH` variable and the current directory are the *only* places the Windows Cmd shell will look for commands, except for a small number of built-ins like `dir`. You're going to need to provide more evidence if you believe differently. – Mark Ransom May 10 '16 at 21:54
  • You can check you're own path variable you will see there is not all the windows program inside and try every program with start without path it's work – Michael May 10 '16 at 21:56
  • Possible duplicate of [How to test if an executable exists in the %PATH% from a windows batch file?](http://stackoverflow.com/questions/4781772/how-to-test-if-an-executable-exists-in-the-path-from-a-windows-batch-file) – Ryan Bemrose May 10 '16 at 22:15
  • Start is the same as typing in Start - Run dialog. Without start CMD preprocesses and then calls CreateProcess on it. Start uses `ShellExecuteEx` which knows many different ways of starting files - *in your case* the main difference that the shell looks up this registry key as well `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths` which is where graphical programs register themselves. –  May 10 '16 at 22:36

1 Answers1

1

Those are programs in the PATH envinronment's variable. Programs that need the "start" command use the "App Paths" registry key.

See https://helgeklein.com/blog/2010/08/how-the-app-paths-registry-key-makes-windows-both-faster-and-safer/

Hellon
  • 86
  • 4
  • 1
    Thanks for teaching me something new! I'd give this an upvote, but it's not an appropriate question for StackOverflow, thus not an appropriate answer either. If it gets migrated to SuperUser, let me know. – Mark Ransom May 10 '16 at 22:50
  • That was I thought and you provide the answer thank to you. I ask this because I try to make a portable app ( c windows) and using exec function with start command is not an option especially in case of fail I don't find a way to catch the ugly windows error message box. – Michael May 11 '16 at 06:06
  • @mikl why didn't you say so in the question? That turns it totally on topic for StackOverflow. – Mark Ransom May 11 '16 at 14:39
  • @MarkRansom because it was not the main point of my question but you're right it was a mistake, i need to move this question into another section ? – Michael May 11 '16 at 19:02
  • @mikl this site is about programming questions. Questions about how an operating system finds a file when you type in a command has nothing to do with programming. Questions about how to do something in your own program the same way the operating system does is absolutely about programming. Your question is in the right place, but there's no point in trying to get it back open unless this answer isn't adequate. – Mark Ransom May 11 '16 at 19:15
  • @MarkRansom ok thanks – Michael May 11 '16 at 19:17