7

Windows has the program start.exe which somehow knows how to open programs by their lay-name like "firefox"

Typing start firefox into cmd.exe opens firefox assuming its installed. Is there a similar command to start that will return the file path rather than starting the application?

Also open to any similar but proper solution

UPDATE: Other answers suggest using where command, and this works for programs like ping which are in the system directories, but does not find firefox like start does.

2 Answers 2

7

Take a look at this registry key.

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

In it you will find something similar to this for firefox.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe]
@="C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"
"Path"="C:\\Program Files (x86)\\Mozilla Firefox"

and here is a bit that reads the value from Powershell. Same thing can be done from batch file with reg.exe.

$Firepath = get-item -path 'registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe'
$Firepath.GetValue('')
Sign up to request clarification or add additional context in comments.

2 Comments

I searched for awhile and never found these keys! Thank you so much. This contains exactly what I was looking for.
The mentioned reg.exe command is reg.exe query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe" /v Path and requires additional output parsing.
0

wmic product get name,version /format:csv > C:\testappu\Computername%.csv

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.