一个Shell脚本批处理,禁用Edge“关闭开发人员模式下的扩展”弹窗,关闭EdgeVpn
飞小RAN
编辑于 2025年10月13日 20:00
收录于文集
共17篇

灵感来源

原理:修改Preferences文件

代码块
Shell
自动换行
复制代码
%LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Preferences
复制成功

(以下为伪代码,可以前往下方下载批处理一键修改)

关闭EdgeVpn[edge_vpn.available, edge_vpn.enabled_globally] = [false, false]; 关闭开发扩展弹窗extensions.ui.dev_mode_warning_snooze_end_time = "9223372036854775807"

一键修改批处理

(会自动关闭Edge浏览器以保证成功修改,请自行确保浏览器工作已保存

代码内容,可以前往下方下载懒人批处理一键修改

①关闭EdgeVpn

代码块
Shell
自动换行
复制代码
taskkill /F /IM msedge.exe
powershell -ExecutionPolicy Bypass -Command ^
    "$filePath = Join-Path $env:LOCALAPPDATA 'Microsoft\Edge\User Data\Default\Preferences';" ^
    "$json = Get-Content $filePath -Raw -Encoding UTF8 | ConvertFrom-Json;" ^
    "if (-not $json.edge_vpn) { $json | Add-Member -MemberType NoteProperty -Name 'edge_vpn' -Value ([pscustomobject]@{ }) };" ^
    "$json.edge_vpn.available = $false;" ^
    "$json.edge_vpn.enabled_globally = $false;" ^
    "$content = $json | ConvertTo-Json -Depth 99 -Compress;" ^
    "$encoding = New-Object System.Text.UTF8Encoding($false);" ^
    "[System.IO.File]::WriteAllBytes($filePath, $encoding.GetBytes($content));"
pause
复制成功

②关闭开发扩展弹窗

代码块
Shell
自动换行
复制代码
taskkill /F /IM msedge.exe
powershell -ExecutionPolicy Bypass -Command ^
    "$filePath = Join-Path $env:LOCALAPPDATA 'Microsoft\Edge\User Data\Default\Preferences';" ^
    "$json = Get-Content $filePath -Raw -Encoding UTF8 | ConvertFrom-Json;" ^
    "if (-not $json.extensions) { $json | Add-Member -MemberType NoteProperty -Name 'extensions' -Value ([pscustomobject]@{ }) };" ^
    "if (-not $json.extensions.ui) { $json.extensions | Add-Member -MemberType NoteProperty -Name 'ui' -Value ([pscustomobject]@{ }) };" ^
    "$json.extensions.ui.dev_mode_warning_snooze_end_time = '9223372036854775807';" ^
    "$content = $json | ConvertTo-Json -Depth 99 -Compress;" ^
    "$encoding = New-Object System.Text.UTF8Encoding($false);" ^
    "[System.IO.File]::WriteAllBytes($filePath, $encoding.GetBytes($content));"
pause
复制成功

下载懒人批处理一键修改

关闭EdgeVpnhttps://wwre.lanzouq.com/iA31h38bs1if

关闭开发扩展弹窗https://wwre.lanzouq.com/isa4q38bro5e