How does Windows find the path for executables like iexplore.exe?

0

1

If I type iexplore into the run window, it runs Internet Explorer. I presume that means C:\Program Files\Internet Explorer is in my path environment variable, but it's not. I checked both my user variables and my system variables. So how does Windows know where to look for this sort of thing?

I suppose I should mention I'm using Windows 8.1 at the moment.

Kyle Delaney

Posted 2017-04-07T19:35:05.080

Reputation: 1 059

I'm guessing through the Environmental Variable(s) %SystemRoot% and %SystemRoo%\system32 – DukeSilversJazz – 2017-04-07T19:38:28.907

2I attempted to run "iexplorer.exe" from a PowerShell prompt, I was told it was an incorrect command, I attempted to run "notepad.exe" and the program executed. I then switched to the directory and ran "iexplorer.exe" and the program ran. So it actually is in your user's path variable. – Ramhound – 2017-04-07T19:40:42.720

2I also ran "iexplorer.exe" from the run command and was told the command was also invalid. So you have changed your path variable from the default (or my user path variable is different) in either case the path IS in the variable otherwise you would get the error. I then provide a path to the executable, and as expected, the program started. – Ramhound – 2017-04-07T19:44:29.913

1Isn't it iexplore.exe? That would be why it's returning as an invalid command. – Darren – 2017-04-07T21:16:49.763

%SystemRoot% refers to C:\Windows, right? I checked there, and C:\Windows\System32, and didn't see iexplore anywhere. – Kyle Delaney – 2017-04-07T21:30:26.267

%PATH% -- asdfasdf – allquixotic – 2017-04-08T02:31:02.600

Answers

3

The computer has used Application Registration with this program. To see a list of such executable files, check out HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

e.g.:

reg QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"

That shows the executables. To show more information about then, use:

reg QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths" /s

Actually, that is just one of the locations that are checked for executable files. The MSDN page on Application Registration has a section called “Finding an Application Executable”, which mentions this as well as some other locations that can get used by the “ShellExecuteEx” function. That function is used by some programming code, including the Run dialog box, but may not be what is used by the traditional command prompt, so that is why you may get different results for a specific command (based on where you are trying to run the command from).

TOOGAM

Posted 2017-04-07T19:35:05.080

Reputation: 12 651

0

You can't run Internet Explorer from the command-line or PowerShell like other programs, because it's executable isn't under C:\Windows\System32. The variable %SystemRoot%references the path C:\Windows\System32, and is where things like Run and Powershell execute programs from by default because their paths start there unless specified otherwise. Internet Explorers execuables are found in:

C:\Program Files\Internet Explorer\iexplore.exe

for 64-bit

and

C:\Program Files (x86)\Internet Explorer\iexplore.exe

for 32-bit

You can execute Internet Explorer with the above paths or put these in a batch file:

%SystemRoot%\explorer.exe "C:\Program Files\Internet Explorer\iexplore.exe"

and:

%SystemRoot%\explorer.exe "C:\Program Files(x86)\Internet Explorer\iexplore.exe"

Hope this helps.

Mr. Mendelli

Posted 2017-04-07T19:35:05.080

Reputation: 1 061

I think you may have misunderstood me. I'm not saying I can't get Internet Explorer to run from the run dialog. I'm saying I can. And I'm asking why that is, since it isn't found in %SystemRoot% like you said. It's also strange that I can run it from the run dialog but not from command line. – Kyle Delaney – 2017-04-07T22:46:39.970

Try it yourself. Press Win+R and type iexplore. – Kyle Delaney – 2017-04-07T22:47:20.850

Tried it, but it doesn't seem to work. It may function differently on Windows 10. As far as running programs directly from run, I believe there may be a list of pre-defined programs that can be executed this way. It's probably registry-based. – Mr. Mendelli – 2017-04-08T04:43:54.970