Universal path to chrome.exe

前端 未结 7 1346
失恋的感觉
失恋的感觉 2020-12-29 04:15

I am making an application and I want to make it installable on the user\'s desktops using chrome URL shortcut. Therefore, is there a universal path to the chrome.exe that c

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-29 04:49

    Chrome installs by default to the User's AppData Local folder:

    XP:
    C:\Documents and Settings\UserName\Local Settings\Application Data\Google\Chrome
    
    Vista:
    C:\Users\UserName\AppDataLocal\Google\Chrome
    
    Windows 7:
    C:\Program Files (x86)\Google\Application\chrome.exe
    

    Update: As mentioned in a comment, it appears the path to chrome.exe has changed in Win7/8. It's now in: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

    Best bet is to use some OS detection code, then use an environment variable to detect the User's AppData folder (i.e. %LOCALAPPDATA%) or the ProgramFiles folder, and then append the difference in OS's to the end of the variable.

提交回复
热议问题