Hkey local machine software microsoft windows currentversion app paths

by: ,
published: Aug 26, 2010,
updated: Oct 24, 2013, in

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:

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:

  1. The current working directory.
  2. The Windows directory.
  3. The Windows\System32 directory.
  4. The directories listed in the PATH environment variable.
  5. 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.

About the Author

Helge Klein (ex CTP, MVP, and vExpert) worked as a consultant and developer before founding vast limits, the uberAgent company, which was acquired by the Citrix business unit of Cloud Software Group in late 2023.
Previously, Helge applied his extensive knowledge in IT infrastructure projects and architected a user profile management product, the successor of which is now available as Citrix Profile Management. Helge is the author of the popular tools Delprof2 and SetACL. He has presented at Citrix Synergy, BriForum, E2EVC, Splunk .conf, and many other events.

Read more

Home
> OS Internals, Tech, Windows > The Windows “App Paths” Registry Key

This was news to me. Basically, not every app has to be on your PATH to be launched via executable name only (from anywhere).

For example, on my x64 Windows 7 machine, WordPad is located at:

<C:\Program Files\Windows NT\Accessories\wordpad.exe>

This is *not* set in my PATH environment variable. But I can go to Start > Run, and type wordpad, and it launches.

Why does this work? Because of “App Paths”.

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

http://helgeklein.com/blog/2010/08/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.

Windows API developer Raymond Chen has more detail on the feature and history on why “App Paths” registry key was created in the first place.

http://blogs.msdn.com/b/oldnewthing/archive/2011/07/25/10189298.aspx

Also note that malware could use this as well. Raymond Chen clarifies it well:

Now, the intent was that the registered full path to the application is the same as the registered short name, just with a full path in front. For example, wordpad.exe registers the full path of %ProgramFiles%\Windows NT\Accessories\WORDPAD.EXE.

But there’s no check that the two file names match. The Pbrush folks took advantage of this by registering an application path entry for pbrush.exe with a full path of %SystemRoot%\System32\mspaint.exe: That way, when somebody types pbrush into the Run dialog, they get redirected to mspaint.exe.

Whenever we load new applications on our computer, they are enabled by default throughout the System disc, that is usually C. By standard, 32-bit software is deployed mostly in the “C: Program Files(x86)” directory, whereas 64-bit applications are placed in the “C: Program Files” directory. One can relocate certain documents to several other discs when the C drive is full. Program Files is among the most significant directories on the C drive, and it occupies up lots of space if you have a lot of applications loaded. Changing the default configuration destination of “C: Program Files” became one approach to save up lots of space inside the C drive. Allow us to demonstrate how to relocate an app or software to a different disc. The procedure you must take varies whether you’d like to relocate a native Windows 10 software or third-party software to another disc.

Change «Program Files» location for all applications

Open the Registry Editor again from the desktop search bar. This time we need to change the default installation folder location for new programs or software that will be installed on our Windows 10 system. Now click on the Computer and expand the subfolder “HKEY_LOCAL_MACHINE”. Within this folder, extract the subfolders of the “SOFTWARE” folder, and then expand the “Microsoft” sub-folder. In this folder, expand the sub-folder “Windows”. At last, double-click on the sub-directory “CurrentVersion” to see its contents. You can see its file contents given on the right portion of the Registry Editor window in the image beneath. If you are using the operating system of 64 bit, you will find two files ProgramFilesDir, and the other is ProgramFilesDir(x86). We have to work on the PogramFilesDir in this context as presented in the image. The overall path to the CurrentVersion folder is as follows:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

Now, right-click on the ProgramFilesDir data file and a dialogue box will appear. Tap on the first option “Modify” to change the default location of new to be installed software programs.

Modify ProgramFilesDir

Now a new dialogue box window has been opened having the name “Edit String”. In the text box of “Value name”, you can alter the name of a directory. On the text box of “Value data”, we can change the default location for new to be installed programs. Hence, change the location of programs here and tap on the “OK” button to carry on. After that, the directory location will be changed in the Registry Editor. To implement these changes, just reboot your Windows 10 system and then look for the default folder of new programs in the C directory and then in the directory you have just updated.

Change the «Program Files» location on Windows 10 for a single app

Windows includes a feature that allows you to relocate contemporary programs to any destination you like. Whereas this approach does not function for classic desktop apps, they may still be moved to a different disc. Let suppose, you have installed the Oracle VM VirtualBox on your Windows 10. As you know, the installation occurs and the installed files have resided in the “C: Program Files” drive on your system as shown in the below snap. You can see the location of a file here is: “C: Program Files/Oracle/VirtualBox”. Now we want to change the default location for Oracle VM Virtual Box, and move it to the D directory of our Windows 10.

Move folder

To change the default location of VM VirtualBox, we need to open the Registry Editor of our Windows 10. There are two methods to open a registry editor. The first one is to open the “Run” application from a search bar of Windows 10 desktop. A dialogue box will appear named “Run”. Write “Regedit” in it and click on the “OK” button to open Registry Editor.

Another method is to search “Registry Editor” directly from the search bar of the Windows 10 desktop. It will appear on your desktop screen. Tap on the Registry Editor App to open it. It will confirm your action by inquiring you to allow it. Tap on the “Yes” button to open Registry Editor.

Regedit

The Registry Editor will be opened. You will find the below screen on your desktop Windows 10 having a Computer as the main folder with some sub-folders in it. We have to look into the HKEY_LOCAL_MACHINE subfolder of the Computer.

HKEY_LOCAL_MACHINE

So, navigate towards the VirtualBox residing in the C directory of the Computer, Let’s first expand the “HKEY_LOCAL_MACHINE”. In the “HKEY_LOCAL_MACHINE” expand the “SOFTWARE” folder. In the “SOFTWARE” directory expand the “Oracle” folder and then tap on the “VirtualBox” folder as shown in the below image. The overall path to be followed is as follows:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\VirtualBox

It will show you the log files and location files of Virtual Box. The file “InstallDir” is the file from which we will change the location of VM VirtualBox.

InstallDir

Right-click on the “InstallDir” file, and then tap on the “Modify” option of the dialogue box.

Modify InstallDir

Now another dialogue box will appear named “Edit String”. It gives you two options to change the file name in the “Value name” text box, and its location from the “Value data” text box. You can see, we have changed the Directory to “D” in the below snapshot. After changing the default location, hit hard on the “OK” button to see the changes.

Now the dialogue box has been disappeared. You can see that the location of a file “InstallDir” has been changed under the “Data” section of the Registry Editor.

Changed installation directory

To see the changes of a default location, restart your system machine and open the D directory of Windows 10. You will find that the VM VirtualBox has been residing in the D directory now.

Conclusion

We have covered two examples to change the default location for the installation folder, and the change of a location for any other software. We hope you enjoy it while implementing it and don’t find any issues.

Download Windows Speedup Tool to fix errors and make PC run faster

In Windows 11/10 OS, the software is installed on your System Drive, usually C drive, in the Program Files folder. The typical path in Windows 32-bit is C:\Program Files and in Windows 64-bit is C:\Program Files and C:\Program Files(x86).

Microsoft recommends the C:\Program Files folder for the default installation destination. It’s a convention that ensures proper inter-operation between your program and the OS’s application and security models. So, once software programs are installed, they go by default to C:\Program files on the computer.

This can, however, be changed by selecting another folder or location or partition.  To change the default installation folder, the data must be modified in the ProgramFilesDir key and a new path must be chosen for the installation folder.

Windows uses the System Disk for installing any new applications; that is, if your Windows is installed on the C Drive, the default folder where all the applications you install would automatically show up as C:\Program Files, unless, of course, you change it manually while installing the application’s locations.

WARNING: Do note that Microsoft does not support changing the location of the Program Files folder by modifying the ProgramFilesDir registry value. It states that if you change the location of the Program Files folder, you may experience problems with some Microsoft programs or with some software updates. And so as such, we do not recommend you try it – as it has worked for some, and not for others – esp. on recent Windows 11/10 builds. If at all you decide to try this suggestion, we recommend that you back up your registry and create a system restore point first.

TIP: Windows 11/10 makes things easy. You can easily move Windows Apps to another Drive and change their Install location.

If you almost always prefer not to install on the System Disk, but instead on another partition, say, the D drive, then rather than changing the default location every time, you can edit the registry as follows:

Before you begin, create a system restore point first.

Now open Regedit and navigate to the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

change default program files directory

Now in the right pane, look for the value ProgramFilesDir and/or ProgramFilesDir (x86) depending on whether your Windows is 32-bit or 64-bit.

Double-click on it and in the box which opens up, change its Value data from C:\Program Files to say, D:\Program Files.

Click OK. Exit.

The default directory for installing all your programs shall now be D:\Program Files.

If you are using Windows 64-bit, you must change the value of ProgramFilesDir and ProgramFilesDir (x86).

Reads that will interest you:

  • How to change the default location of the Documents folder or profile personal files
  • How to change the default install location of Windows Store Apps.

Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP (2006-16) & a Windows Insider MVP (2016-2022). Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.

Reader Interactions


Readers help support Windows Report. We may get a commission if you buy through our links.

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

Normally if you have Windows 10 or any other version of Windows operating systems, you will definitely have your Program Files folder located on your C:/ drive where the operating system itself is usually installed.

This is mainly because the system needs to ensure a good correlation between the programs that you are installing and the operating system.

Of course, you can change this location anytime and we will see how to do so by reading the tutorial posted a few rows below.

But first of all, we will need to know the consequences that may happen if we change the Program Files folder location.

Mainly the program files folder is put there for a good reason, if you move it and all your programs will be moved to another location you may experience some system errors after a while.

How to change the location of program files in Windows 10?

    The program files location can be changed using the built-in Registry Editor. You need to access the tool and then manually modify the path of the program files folder.

  1. 1. While on your Desktop, you will need to press the Windows and R keys. This will open the Run dialog.

  2. 2. Type regedit and then press Enter or click OK.

  3. 3. Now you should have the Registry Editor window in front of you.

  4. 4. Navigate to the following key:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir

    • Note: if you have a 64 bit system it will be a ProgramFilesDir (x86) item.
    program files directory w10

  5. 5. Double click (left click) on it.

  6. 6. From there, you will be able to change the path of the Program Files folder by entering a new path in the Value data section of the window.

  7. 7. After you are done selecting a path you will need to click on OK and then close the Registry Editor window.

  8. 8. If the changes did not work after you closed the window, try a reboot of the system and try it afterward.

Read more about this topic

  • Microsoft Office Lens: A Powerful Tool for Capturing and Organizing Information
  • Swap Left/Right Speaker in Realtek Audio Console [How to]

Now, you know how to change the path of the program files folder and you can see that it didn’t take up much of your time.

Always keep in mind that if you change the path of the program files folder, this may cause malfunctions in the system.

Microsoft made it clear that it does not support changing the location of the program files:

Microsoft does not support changing the location of the Program Files folder by modifying the ProgramFilesDir registry value. If you change the location of the Program Files folder, you may experience problems with some Microsoft programs or with some software updates.

We hope that our solution helped you change the location of your Program Files folder. However, you should revert the action if problems occur.

Don’t forget to provide your feedback in a comment below if you have any other suggestions.


Ivan Jenic

Windows Hardware Expert

Passionate about all elements related to Windows and combined with his innate curiosity, Ivan has delved deep into understanding this operating system, with a specialization in drivers and driver troubleshooting.

When he’s not tackling diverse driver-related problems, Ivan enjoys watching good movies and spending time hiking with his family and friends.


Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Radeon x1650 driver windows 10
  • Как в windows посмотреть разделы linux
  • Обход блокировки установки windows 11
  • Как перенести ос windows на виртуальную машину vmware
  • Samsung np300e5c drivers windows 10