简体   繁体   English

使用 PowerShelll 将 Microsoft Edge 设置为默认浏览器

[英]Set Microsoft Edge as default browser with PowerShelll

I'm doing a script that change the default browser to the Microsoft Edge and I have done this:我正在做一个脚本,将默认浏览器更改为 Microsoft Edge,我已经这样做了:

  function Set-DefaultBrowser {
Add-Type -AssemblyName 'System.Windows.Forms'
Start-Process $env:windir\system32\control.exe -LoadUserProfile -Wait -ArgumentList '/name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=MSEdgeHTM'
Sleep 10
[System.Windows.Forms.SendKeys]::SendWait("{TAB}{TAB}{TAB}{TAB}{TAB} {ENTER}{ENTER} ")
}
Set-DefaultBrowser

But i don't like that is like a person where doing it opening the menu and that stuff I would like to do it like without showing it like that, it is posible to do it that way?但我不喜欢这样的人,就像一个人在打开菜单和我想做的事情而不像那样显示它,这样做是可能的吗?

My recommendation is to set the Regkeys that control default browser.我的建议是设置控制默认浏览器的 Regkeys。 Here is a link to a post showing how to do it with Chrome这是一篇文章的链接,展示了如何使用 Chrome 进行操作

https://itectec.com/superuser/cmd-command-to-set-chrome-as-default-browser-windows-10/ https://itectec.com/superuser/cmd-command-to-set-chrome-as-default-browser-windows-10/

You'll notice the command needed but change the app name to that of Edge您会注意到所需的命令,但将应用名称更改为 Edge 的名称

Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice' -Name ProgId -Value 'ChromeHTML'

Set-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice' -Name ProgId -Value 'ChromeHTML'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将“Edge/chrome 浏览器应用程序”设置为文件扩展名的默认应用程序 - How to set a "Edge/chrome Browser app" as a default applicationo for a file extension 如何在 Microsoft Edge 浏览器中打开本地 HTML 文件? - How can I open a local HTML file in Microsoft Edge browser? 如何在具有静音打印的信息亭模式下设置 Microsoft Edge Chromium? - How to set up Microsoft Edge Chromium in kiosk mode with silent printing? 如何使用 Javascript 在 Microsoft Edge 浏览器中获取私有客户端 IP 地址? - How to get private client IP address in Microsoft Edge browser using Javascript? PrintWindow和Microsoft Edge - PrintWindow and Microsoft Edge Microsoft Edge Webview 问题 - Microsoft Edge Webview Issues 如何在R中将默认浏览器设置为Internet Explorer? - How to set default browser to Internet Explorer in R? Windows,设置计算机(浏览器)默认Web代理 - windows, set computer(browser) default web proxy CreateProcess 启动边缘浏览器 - CreateProcess launching edge browser 如何使用 windows 11 上的 selenium 3.141.59 在 IE MODE 浏览器中设置 MS-Edge 的缩放级别? - How to set zoom level for MS-Edge in IE MODE browser using selenium 3.141.59 on windows 11?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM