powshell脚本 [ol]$regPath = "HKCU:\Software\Microsoft\Edge\BLBeacon\settings" $homePageKey = "HomePage" $homePageValue = "ht tp s: // www .exam ple.com" if (-not (Test-Path $regPath)) { New-Item -Path $regPath -Force | Out-Null } Set-ItemProperty -Path $regPath -Name $homePageKey -Value $homePageValue [/ol]复制代码
编写一个.reg文件或PowerShell脚本,自动导入注册表设置。示例.reg文件内容: [ol]Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge] "HomepageLocation"="https://www.example.com" "OpenHomepageOnStart"=dword:00000001[/ol]复制代码 [ol]@echo off reg add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /f /v "HomepageLocation" /t REG_SZ /d "https://www.example.com" reg add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /f /v "OpenHomepageOnStart" /t REG_DWORD /d 1 exit[/ol]复制代码
[ol]# 设置注册表路径(官方推荐路径) $regPath = "HKCU:\Software\Policies\Microsoft\Edge" $homePageKey = "HomepageLocation" $openOnStartKey = "OpenHomepageOnStart" $homePageValue = "https://www.example.com" # 检查注册表路径是否存在,如果不存在则创建 if (-not (Test-Path $regPath)) { try { New-Item -Path $regPath -Force | Out-Null Write-Host "注册表路径已创建:$regPath" } catch { Write-Error "无法创建注册表路径:$regPath。请以管理员身份运行 PowerShell。" exit } } # 设置主页地址 try { Set-ItemProperty -Path $regPath -Name $homePageKey -Value $homePageValue -Force Write-Host "主页已设置为:$homePageValue" } catch { Write-Error "无法设置主页键值:$homePageKey" } # 启用启动时打开主页 try { Set-ItemProperty -Path $regPath -Name $openOnStartKey -Value 1 -Force Write-Host "已启用:启动时打开主页" } catch { Write-Error "无法设置启动时打开主页键值:$openOnStartKey" }[/ol]复制代码
我将 3# 转为:批处理 @echo off reg add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /f /v "HomepageLocation" /t REG_SZ /d "https://www.example.com" reg add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /f /v "OpenHomepageOnStart" /t REG_DWORD /d 1 exit
yyz2191958 发表于 2026-2-25 10:57 我将 3# 转为:批处理 @echo off reg add "HKLM\SOFTWARE\Policies\Microsoft\Edge" /f /v "HomepageLoca ... 謝謝分享,非常感謝您!