2013-07-08 44 views
0

將Chrome設爲默認瀏覽器,我收到以下錯誤消息。無法從Powershell的

cmd.exe : [1396:2128:0708/153347:ERROR:gpu_info_collector_win.cc(98)] Can't retrieve a valid WinSAT assessment. At line:1 char:1 + cmd.exe /C "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --make- ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ([1396:2128:0708...SAT assessment.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError

[1396:2128:0708/153347:ERROR:shell_integration_win.cc(200)] Chrome could not be set as default browser.

什麼可能導致此錯誤?我意識到執行該命令有多種方式,但底線是執行Chrome --make-default-browser開關失敗。

+0

這是PowerShell的特定問題嗎?換句話說,它是否可以從標準命令行在您的機器上運行? – neontapir

+0

我可以在Chrome的設置中進行設置。如果我直接運行'cmd',則不會引發錯誤,但它也不會設置設置。 –

回答

2

以下爲我工作:

$chromePath = "${Env:ProgramFiles(x86)}\Google\Chrome\Application\" 
$chromeApp = "chrome.exe" 
$chromeCommandArgs = "--make-default-browser" 
& "$chromePath$chromeApp" $chromeCommandArgs 
+0

是的,我試過了。我想知道現在是否在Chrome/Win8中出現問題。我有一個全新的Win8安裝,我用[巧克力](http://chocolatey.org)來安裝chrome'cinstm GoogleChrome' –

0

的WinSAT是Windows體驗指數。它測量系統性能:CPU,內存,圖形和硬盤速度,並提供從1到7.9的單個數字,代表您的系統性能。軟件發行商(主要是圖形密集型遊戲)應該發佈最低WinSAT分數,以便從他們的遊戲中獲得良好的體驗。 (這是Win7之前的計劃,但我沒有達到它實際使用的程度)。

無論如何,你可以去控制面板,系統,你應該看到窗口中間的「評級」。您可以點擊旁邊的消息來獲得評分。

我認爲Chrome正在抱怨沒有評級。 (雖然這是一個很大的模糊,不管它是鉻或CMD)嘗試評級你的系統,看看它是否工作。

4

試試這個鏈接在poshcode,你可以在Chrome,Firefox,Internet Explorer,Opera和Safari之間切換。我已經與所有版本的瀏覽器5測試...

  • 鉻= 39
  • 火狐= 34
  • 的Internet Explorer = 11
  • 歌劇= 11
  • Safari瀏覽器= 5

PoShCode片段內的代碼如下...

function Set-DefaultBrowser 
{ 
    param($defaultBrowser) 

    $regKey  = "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\{0}\UserChoice" 
    $regKeyFtp = $regKey -f 'ftp' 
    $regKeyHttp = $regKey -f 'http' 
    $regKeyHttps = $regKey -f 'https' 

    switch -Regex ($defaultBrowser.ToLower()) 
    { 
     # Internet Explorer 
     'ie|internet|explorer' { 
      Set-ItemProperty $regKeyFtp -name ProgId IE.FTP 
      Set-ItemProperty $regKeyHttp -name ProgId IE.HTTP 
      Set-ItemProperty $regKeyHttps -name ProgId IE.HTTPS 
      break 
     } 
     # Firefox 
     'ff|firefox' { 
      Set-ItemProperty $regKeyFtp -name ProgId FirefoxURL 
      Set-ItemProperty $regKeyHttp -name ProgId FirefoxURL 
      Set-ItemProperty $regKeyHttps -name ProgId FirefoxURL 
      break 
     } 
     # Google Chrome 
     'cr|google|chrome' { 
      Set-ItemProperty $regKeyFtp -name ProgId ChromeHTML 
      Set-ItemProperty $regKeyHttp -name ProgId ChromeHTML 
      Set-ItemProperty $regKeyHttps -name ProgId ChromeHTML 
      break 
     } 
     # Safari 
     'sa*|apple' { 
      Set-ItemProperty $regKeyFtp -name ProgId SafariURL 
      Set-ItemProperty $regKeyHttp -name ProgId SafariURL 
      Set-ItemProperty $regKeyHttps -name ProgId SafariURL 
      break 
     } 
     # Opera 
     'op*' { 
      Set-ItemProperty $regKeyFtp -name ProgId Opera.Protocol 
      Set-ItemProperty $regKeyHttp -name ProgId Opera.Protocol 
      Set-ItemProperty $regKeyHttps -name ProgId Opera.Protocol 
      break 
     } 
    } 

# thanks to http://newoldthing.wordpress.com/2007/03/23/how-does-your-browsers-know-that-its-not-the-default-browser/ 

<# 
(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice').ProgId 
(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice').ProgId 
(Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice').ProgId 
#> 

} 

# Set-DefaultBrowser cr 
# Set-DefaultBrowser ff 
# Set-DefaultBrowser ie 
# Set-DefaultBrowser op 
# Set-DefaultBrowser sa 
+0

我剛剛在Windows 10中嘗試了這一點,但它不起作用。它只是觸發了以下Windows錯誤:'一個應用程序導致您的默認瀏覽器設置出現問題,因此它被重置爲Microsoft Edge。' – Sam

+1

@Sam,這是已知的Windows 10問題。請參閱:http://www.winhelponline.com/blog/windows-10-resetting-file-associations/或http://winaero.com/blog/prevent-windows-10-from-resetting-your-default-apps / – TechSpud