https://helgeklein.com/blog/how-the-app-paths-registry-key-makes-windows-both-faster-and-safer/
How the App Paths Registry Key Makes Windows Both Faster and Safer
Why can you start Mozilla Firefox by typing "firefox" in the Run dialog and press enter? Firefox.exe is not located in any directory in the path.
The same with Outlook (type "outlook"), PowerShell ("powershell"), VMware Workstation ("vmware") or Adobe Reader ("acrord32").
This "magic application starting thingy" works because of a little-known Windows feature based on the "App Paths" registry key.
App Paths - Dissection
In your forays through the Windows registry you may have noticed a peculiar key, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths, that has subkeys named like executables.
Here is what it looks like on my machine: https://helgeklein.com/wp-content/uploads/2010/08/app-paths-registry-key.png
Notice that the HKLM App Paths key and its counterpart in HKCU are
basically mapping tables between executable names and their full paths.
The direct subkeys of App Paths store the executable names, while each subkey's default value stores the full path to that executable.
Notice also, that the key "firefox.exe" has a named value "Path" that
stores the path to the program's installation directory.
So what is this all about?
App Paths - Explanation
The App Paths key provides a mechanism that allows programmers to make
their application startable by name only without having to modify the system-wide path.
Why would they do that? Vanity and overestimation of the importance of one's own application.
But, hey, it sometimes does come in handy to be able to start programs without having to type the full path, just hit Win+R instead and type the executable name.
Getting more technical, modifying the system path is not exactly best practice since it may slow down the system, break other applications and
even create security holes.
To provide an alternative, Microsoft added the App Paths functionality in
XP.
Whenever a new process is to be started with the API functions ShellExecute or ShellExecuteEx, and only a file name without a path is specified,
Windows looks in the following places for the executable:
The current working directory.
The Windows directory.
The Windows\System32 directory.
The directories listed in the PATH environment variable.
If there is a App Paths subkey with the name of the executable, the key's default value is used as the program's full path. If the subkey also has a value named Path, the string stored in Path is added to the PATH
environment variable, but only for the process to be started.
As mentioned, the App Paths key has a second use, namely proving
per-process PATH configurations, reducing the need of application
developers to modify the global system PATH.
For further information and a list of other possible values please see the MSDN article Application Registration [App PathsProcessRegistry]. http://msdn.microsoft.com/en-us/library/ee872121%28VS.85%29.aspx
Not a bad idea, but don't change from 32bit to 64bit apps.
Path of /program files and /program files(x86) would/will
screw this up unless there is some logic during install to
correct the reg key.
The "App Path" is different from the "$PATH" in how it works. https://micksmix.wordpress.com/2011/08/19/the-windows-app-paths-registry-key/
On Sun, 19 Mar 2023 21:39:16 +0200, Freethinker wrote:
The "App Path" is different from the "$PATH" in how it works.
https://micksmix.wordpress.com/2011/08/19/the-windows-app-paths-registry-key/
That's an interesting description of AppPath; thank you.
But what is this $PATH you mentioned in passing? Are you referring to something in UNIX? In Windows it would be %PATH, right? (I'm not
busting your chops here; I really want to know.)
echo %path%
echo %path # Doesn't work with just one percent%path
The "App Path" is different from the "$PATH" in how it works.
https://micksmix.wordpress.com/2011/08/19/the-windows-app-paths-registry-key/
That's an interesting description of AppPath; thank you.
But what is this $PATH you mentioned in passing? Are you referring to something in UNIX? In Windows it would be %PATH, right? (I'm not
busting your chops here; I really want to know.)
That's an interesting description of AppPath; thank you.
But what is this $PATH you mentioned in passing? Are you referring to
something in UNIX? In Windows it would be %PATH, right? (I'm not
busting your chops here; I really want to know.)
PS > cmd # Switch to Command Prompt Microsoft Windows [Version 10.0.22621.1413]
(c) Microsoft Corporation. All rights reserved.
echo %path%
...
C:\WINDOWS; # Lots of custom crap in there...
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\Program Files\gs\gs9.56.1\bin;
...
echo %path # Doesn't work with just one percent%path
The %path% seems to be the puppy.
Just like %userprofile% in Command Prompt is your home dir.
In Powershell, this seemed to work, after a fashion.
echo $env:Path
echo %path%XP PRO (2004) path:
One interesting tidbit is while I was testing that, I noticed this was
not registered (so that it's therefore available for you to use at will)
Win+R font
But that this was already registered (so you shouldn't probably use it)
Win+R fonts
On Sun, 19 Mar 2023 21:39:16 +0200, Freethinker wrote:
The "App Path" is different from the "$PATH" in how it works. https://micksmix.wordpress.com/2011/08/19/the-windows-app-paths-registry-key/
That's an interesting description of AppPath; thank you.
But what is this $PATH you mentioned in passing? Are you referring to something in UNIX? In Windows it would be %PATH, right? (I'm not
busting your chops here; I really want to know.)
In article <MPG.3e822af6a3c12ad899009e@news.individual.net>, Stan Brown wrote...
On Sun, 19 Mar 2023 21:39:16 +0200, Freethinker wrote:
The "App Path" is different from the "$PATH" in how it works. https://micksmix.wordpress.com/2011/08/19/the-windows-app-paths-registry-key/
That's an interesting description of AppPath; thank you.
But what is this $PATH you mentioned in passing? Are you referring to something in UNIX? In Windows it would be %PATH, right? (I'm not
busting your chops here; I really want to know.)
Interesting thread. The easiest way to see the variables (all types) set in your session is to open a command windows and type at the prompt: SET
In PowerShell (which I still haven't learned!) the equivalent seems to be Get-
Variable, but there doesn't seem to be an equivalent to %PATH.
To take a common example likely everyone has, this common app path sub key:
HKLM\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe
@Default=C:\path\firefox.exe
Doesn't actually have to be "firefox.exe" but even "f.exe" would work.
HKLM\Microsoft\Windows\CurrentVersion\App Paths\f.exe
@Default=C:\path\firefox.exe
I don't have any App Path in the HKLM hierarchy, and only four in the
HKCR hierarchy: OneDriveFileLauncher.exe, Skype.exe, WindowsPackageManagerServer.exe, winget.exe.
I didn't create any of
them and don't use any of them. They must have been part of the
Windows install, though why they're in HKCR instead of HKLM I don't
know.
But you and I work very differently. I hardly ever use the "Run"
window in any form, other than for regedit.
Much of what I do is on
the command line, where I have aliases defined so I don't need to
bloat up %PATH% _and_ don't have to type the paths myself.
For the
rest I use standard keyboard shortcuts, like Windows+E to open File
Explorer. And I defined my own shortcuts for the programs I use
frequently: Ctrl+Alt+I for Irfanview, Ctrl+Alt+E for Excel, etc. I
use the mouse and Start Menu only to launch infrequently used
programs.
If App Path worked on the command line, I might use it, but as it
doesn't (I tried an experiment) I can say that it's interesting but
not directly relevant to me.
On 21.03.23 20:53, Stan Brown wrote:
I don't have any App Path in the HKLM hierarchy, and only four in the
HKCR hierarchy: OneDriveFileLauncher.exe, Skype.exe, WindowsPackageManagerServer.exe, winget.exe.
I don't see how that's possible given what I've seen of the App Paths
(note the spelling is plural)
I don't see how that's possible given what I've seen of the App Paths
(note the spelling is plural)
I did a direct jump to
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Path
without the "s" suffix, so that explains why I thought there was
nothing there.
To compound my error, when looking under HKCR I
started at
HKCR\SOFTWARE\Microsoft\Windows\
and then clicked down the hierarchy to open things, again without
noticing the end "s" at the last stage. So that explains why I found
some App Pathses in HKCR.
When I retry with
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
there are a few dozen entries.
But still, since App Paths doesn't work on the command line, it's not
much use to me.
I created test.bat and put it in my %path%, where it contained one line.
%comspec% /k echo hello
I also created an App Paths sub key test.exe containing this @Default.
c:\path\family.xls
Is there a listing of all pre-registered Windows 10/11 keywords anywhere?
I could do the same one-word command called "jakarta" using this subkey:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\jakarta.exe
@Default=c:\path\jakarta.bat
But perhaps more useful would be an abbreviation of the jakarta name.
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\jak.exe
@Default=c:\path\jakarta.bat
That way, I could type jakarta or jak (or foo) and the batch file runs.
Can this easily be done using the %path% method?
But perhaps more useful would be an abbreviation of the jakarta name.
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\jak.exe
@Default=c:\path\jakarta.bat
That way, I could type jakarta or jak (or foo) and the batch file runs. Can this easily be done using the %path% method?
You still don't believe, that there is no difference. You make
a second entry in the registry and I make a second entry in
PATH-directory:
jak.bat with the content:
jakarta.bat
But a more elegant way (for a NTFS volume) would be:
mklink /h jak.bat jakarta.bat
This is a better test which shows how Microsoft designed the order of
App Paths
%path%
%pathext%
On 23.03.2023 01:50, Freethinker wrote:
It's only after I rename the App Paths "test.exe" to something other than "test" that the %path% wins out over my App Paths in that specific test.
I did only a quick testing (so I may be wrong) but as I see it:
If you use "start progname" it use %PATH% first and then "App Path"
If you use "<WIN>-r progname" it use "App Path" first and then %PATH%
The first place in the above search order it finds an executable,
it is executed (no matter whether it is a com exe or bat). Only
if there are more executable in this directory, the order is
.com , .exe, .bat
If you open a CMD window and type
wordpad
you get a not found message (because it is not in the %PATH%).
If you use
start wordpad
Wordpad is started (I suppose, because of the "App Path" entry)
<WIN>-r wordpad also starts Wordpad.
wordpadfails
start wordpadworks
Now create a wordpad.bat in a PATH-directory with the content "pause". "wordpad" and "start wordpad" now start the batch.
Whereas "<WIN>-r wordpad" still starts Wordpad.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 297 |
Nodes: | 16 (2 / 14) |
Uptime: | 03:09:41 |
Calls: | 6,666 |
Calls today: | 4 |
Files: | 12,212 |
Messages: | 5,335,697 |