For my class assignment I need to add Google Chrome to Environment Variables. I tried to go there, click on edit in the Path variable, click on new and add this: %chrome%C:\Program Files\Chrome\Application\Chrome.exe
(The Google Chrome is installed in Program Files, instead of the one with (x86)
When I apply and try to execute chrome in CMD, it gives me this error:'chrome is not recognized as an internal or external command, operable program or batch file.
What do I do in order to be able to open chrome in CMD by just typing chrome without having to type, start chrome? Thanks a lot.
12 Answers
I suppose it's worth a little more detail to cover all forms of this.
You may have noticed that if you run Chrome.exe from the Run box (WinKey+R), Chrome magically launches without even considering updating the Path variable. This is due to "App Paths". Specifically for Chrome, the following registry key is created:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe
In the case of launching an application such as Chrome from a command prompt, you have a couple of options:
- Open or change to the directory where Chrome.exe resides, e.g.
CD C:\Program Files (x86)\Google\Chrome\Applicationand run Chrome.exe. - Add the directory where Chrome.exe resides to the
Pathenvironment variable to it can be "found" from any location.
Tip: You can confirm from a command prompt if an application, such as Chrome.exe will be found in the "path" by running where.exe chrome.exe. If it's not in the path, then it will return: INFO: Could not find files for the given pattern(s). If, as per option 1, you change to the location of chrome.exe first and run where.exe chrome.exe the path will be returned.
For option 2, you are wanting to affect the Process Environment Block (PEB) of processes by updating the path environment variable to add, in this case, C:\Program Files (x86)\Google\Chrome\Application to the path. For example, you might run SystemPropertiesAdvanced to launch System Properties, from there click Environment Variables..., then comes the question, do you want to update the PATH variable for just the logged on user or for the System?
In the example of System, edit the Path variable and add it to the end of the list and click OK. For any existing processes that are running, e.g. command prompts (cmd.exe), the PEB of these processes hasn't been affected by this modification. If however you launch a new process, e.g. a new command prompt and run set and you will see the updated Path variable.
As a test, in the newly launched command prompt, run where.exe chrome.exe. This time it will return the path.
Tip: To learn more, if you run Process Monitor (Microsoft/Sysinternals) you will see the parent process to Chrome.exe, in this case cmd.exe looking for chrome.exe in the search path prior to finding it in the newly added path location. It is for this reason the items in the search path do, slightly affect performance and can also be a security concern. You can also look at the Process Start event for the Environment variables.
Open the directory where Chrome.exe exists, e.g. CD C:\Program Files (x86)\Google\Chrome\Application and then run Chrome.exe. Add the directory where Chrome.exe resides to the Path environment variable to it can be "found" from any location.