2013-07-08 109 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