0

I currently have 5 browsers in my Windows -- MicrosoftEdge, Internet Explorer 11, Chrome, Firefox and Opera. I am using cmd by searching the executables of these browsers to check if they are installed in the system, which I will create a batch script later on for checking purposes.

However, only 2 of the 5 browsers are found in after looking through the directories. The two ways to look for specific files/folder I tried both give the same results.

The following are the default naming convention of the browser executables:

MicrosoftEdge - MicrosoftEdge.exe

Internet Explorer 11 - iexplore.exe

Google Chrome - chrome.exe

Mozilla Firefox - firefox.exe

Opera - launcher.exe

The following are what I already tried:

dir /a /s

and

where

Example Results:

dir /a /s MicrosoftEdge.exe

Volume in drive C is Windows
Volume Serial Number is 0AAC-370F

Directory of C:\Users\User\AppData\Local\Microsoft\WindowsApps

15/10/2019  01:05 pm                 0 MicrosoftEdge.exe
           1 File(s)              0 bytes

Directory of C:\Users\User\AppData\Local\Microsoft\WindowsApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe

15/10/2019  01:05 pm                 0 MicrosoftEdge.exe
           1 File(s)              0 bytes

 Total Files Listed:
           2 File(s)              0 bytes
           0 Dir(s)  269,413,756,928 bytes free

dir /a /s chrome.exe

Volume in drive C is Windows
Volume Serial Number is 0AAC-370F    
File Not Found

where MicrosoftEdge.exe

C:\Users\User\AppData\Local\Microsoft\WindowsApps\MicrosoftEdge.exe

where chrome.exe

INFO: Could not find files for the given pattern(s).

I did the same for the rest and apart from MicrosoftEdge, only Opera can be located and the rest were unable to be found. Am I using the wrong search methods or are there any other methods that can locate all of them?

Rulilia
  • 1
  • 3
  • What about `cd /D "C:\" && dir /S /A:-D "MicrosoftEdge.exe" "iexplore.exe" "chrome.exe" "firefox.exe" "launcher.exe"`, etc.? – aschipfl Oct 15 '19 at 08:28
  • Oh my god thank you! It works really really well and gives the required output! – Rulilia Oct 15 '19 at 08:36
  • or even shorter `where /R C:\ "MicrosoftEdge.exe" "iexplore.exe" "chrome.exe" "firefox.exe" "launcher.exe"` – Gerhard Oct 15 '19 at 08:38
  • Thank you so much! All these helped really well! – Rulilia Oct 15 '19 at 08:45
  • I do suggest you read up on the very helpful, built in help topics. For the above mentioned commands by @aschipfl and myself open `cmd` and type `dir /?` and `where /?` – Gerhard Oct 15 '19 at 08:47
  • Alright, thank you very much for the advice! I will also take a look at the manuals! – Rulilia Oct 15 '19 at 08:51
  • Why do you search the entire drive `C:` for executables? The browsers follow the Microsoft guidelines for [application registration](https://learn.microsoft.com/en-us/windows/desktop/shell/app-registration). For an example see the code in [this answer](https://stackoverflow.com/a/29809234/3074564). I am not sure if that works also for Microsoft Edge because Edge is a "Windows App" and not a Windows GUI application. I have currently no access to a PC with Windows 8 or Windows 10 to verify how Edge is registered in Windows registry. – Mofi Oct 16 '19 at 05:38
  • The registry queries would work also with a browser not installed somewhere on drive C: and is much faster than any other solution although more code is necessary in batch file as `reg.exe` needs to be executed in a __FOR__ loop to get the installation path of all currently installed internet browsers. – Mofi Oct 16 '19 at 05:40
  • @Mofi I'm checking if a browser is installed or not as part of the batch script in order to initiate further actions in a school project. Not necessarily checking the C: for executables, which is why I thought searching for the executables would be a way of finding out if the browser is installed or not. – Rulilia Oct 16 '19 at 09:06
  • @Rulilia This makes the registry queries even easier. You have just to query if for example the registry __key__ `HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe` exists. Example: `@for %%I in ("MicrosoftEdge.exe" "iexplore.exe" "chrome.exe" "firefox.exe" "launcher.exe") do @%SystemRoot%\System32\reg.exe query "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\%%~I" >nul 2>nul && (@echo %%~nI is installed.)|| @echo %%~nI is not installed.` – Mofi Oct 16 '19 at 09:19
  • @Mofi Aahhh, alright. Thank you so much! I didn't think about looking into registries before. – Rulilia Oct 16 '19 at 12:07

0 Answers0