Detect if program is installed and where cmd.exe is used

Windows has a start.exe program that somehow knows how to open programs by name, for example, "firefox"

Entering start firefoxcmd.exe opens firefox if it is installed. Is there a similar command to run that will return the path to the file rather than launching the application?

Also open to any similar but correct decision.

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

+4
source share
1

.

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

- 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"

, Powershell. reg.exe.

$Firepath = get-item -path 'registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe'
$Firepath.GetValue('')
+5

Source: https://habr.com/ru/post/1524889/


All Articles