detecting os and windows path - #25
Conversation
danielkaiser
commented
Apr 1, 2023
Hi @andersoncarlosfs I just had a look at your code and I'm wondering if this approach has any advantages over the much simpler way of querying the windows registry? This code gives the complete version string at least on my system and even does not require the exact location of the Chrome installation: importwinregwithwinreg.OpenKeyEx(winreg.HKEY_CURRENT_USER, r"Software\Google\Chrome\BLBeacon") askey:
version=winreg.QueryValueEx(key, "version")[0]With the check for Windows/Cygwin you added and your refactored |
danielkaiser
commented
May 13, 2023
Hi @andersoncarlosfs , any update on this? |
andersoncarlosfs
commented
May 15, 2023
Hello @danielkaiser, Well, I was testing your suggestion and I found that it does not work if Chromium/Chrome was not installed by a wizard. However, my solution still works in any case. Besides, I found an answer on Stack Overflow proposing a code less complex: ![]() |
danielkaiser
commented
Jun 5, 2023
Hi @andersoncarlosfs, sorry for the late response, I haven't had access to my windows machine lately to test things. The issue I see with this solution is that it needs to know the exact file path (for example I have the 64bit version of Chrome installed and thus had to remove As there seems to be no perfect solution for Windows a combination of the last two discussed options might be the best option. So getting the information from registry and if that fails try to find Also I would think it would be better to remove the output=subprocess.check_output(['wmic', 'datafile', 'where', r'name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"', 'get', 'Version', '/value'])For a hardcoded string this should be no issue but as this part might be changed in the future this could be a problem |
andersoncarlosfs
commented
Aug 22, 2023
Done! |
andersoncarlosfs
commented
Aug 22, 2023
Done! |
andersoncarlosfs
commented
Aug 22, 2023
Hello @danielkaiser , Please, feel free to make suggestions! Have a nice day, |

Detecting OS and installation path of Chrome on Windows