目录

整理了下常年积累的各种奇怪的 Windows 相关问题,如果运行失败可以再“以管理员身份运行”重试

  • 一键禁用 Windows Defender
  • 一键禁用 Windows Update
  • 无法进入微软商店 / XBox 自查
  • 管理员取得所有权
  • 删除快捷键图标
  • 家庭版开启组策略编辑器
  • 修复 gpedit.msc
  • 修复 msvcp110.bat
  • Windows 激活

一键禁用 Windows Defender

下载 Windows Defender Control 后,运行并一键禁用


一键禁用 Windows Update

下载 Windows Update Blocker v1.8 或 Windows Update Blocker v1.8 (x64) 后,运行并一键禁用


无法进入微软商店 / XBox 自查

  • Windows 更新已打开(可使用上述工具一键开启)
  • 登云梯已关闭

管理员取得所有权

创建如下 .reg 文件并运行:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\runas]
@="管理员取得所有权"
"NoWorkingDirectory"="
"[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F""IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
[HKEY_CLASSES_ROOT\exefile\shell\runas2]
@="管理员取得所有权"
"NoWorkingDirectory"="
"[HKEY_CLASSES_ROOT\exefile\shell\runas2\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F""IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="管理员取得所有权"
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t""IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

删除快捷键图标

创建如下 .bat 文件并运行:

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" /v 29 /d "%systemroot%\system32\imageres.dll,197" /t reg_sz /f
taskkill /f /im explorer.exe
attrib -s -r -h "%userprofile%\AppData\Local\iconcache.db"
del "%userprofile%\AppData\Local\iconcache.db" /f /q
start explorer.exe

家庭版开启组策略编辑器

创建如下 .bat 文件并运行:

@echo off
pushd "%~dp0"
dir /b %systemroot%\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >gp.txt
dir /b %systemroot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>gp.txt
for /f %%i in ('findstr /i . gp.txt 2^>nul') do dism /online /norestart /add-package:"%systemroot%\servicing\Packages\%%i"
pause

修复 gpedit.msc

创建如下 .bat 文件并运行:

@echo off
pushd "%~dp0"
dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt
dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt
for /f %%i in ('findstr /i . List.txt 2^>nul') do dism /online /norestart /add-package:"C:\Windows\servicing\Packages\%%i"
pause

修复 msvcp110.bat

创建如下 .bat 文件并运行:

@echo off
setlocal EnableExtensions
 title Repair msvcp110.dll

:: Relaunch as administrator when needed
net session >nul 2>&1
if not "%errorlevel%"=="0" (
  powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
  exit /b
)

set "WORK=%TEMP%\msvcp110_repair"
if not exist "%WORK%" mkdir "%WORK%"

echo This will install Microsoft's Visual C++ 2012 Update 4 runtime.
echo No standalone DLL will be downloaded.
echo.

:: Install x86 runtime on every Windows system (needed by 32-bit apps).
call :Install "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe" "%WORK%\vcredist_x86.exe"
if errorlevel 1 goto :Failed

:: Also install x64 runtime on 64-bit Windows. Include the native OS architecture when this is a 32-bit command prompt.
if defined PROCESSOR_ARCHITEW6432 set "PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITEW6432%"
if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" call :Install "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe" "%WORK%\vcredist_x64.exe"
if /i "%PROCESSOR_ARCHITECTURE%"=="ARM64" call :Install "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe" "%WORK%\vcredist_x64.exe"
if errorlevel 1 goto :Failed

echo.
echo Runtime installation finished. Try opening the affected program again.
echo If the error remains, restart Windows and reinstall or repair that program.
pause
exit /b 0

:Install
set "URL=%~1"
set "FILE=%~2"
echo Downloading %~nx2 from Microsoft...
powershell -NoProfile -ExecutionPolicy Bypass -Command "try { Invoke-WebRequest -UseBasicParsing -Uri '%URL%' -OutFile '%FILE%'; exit 0 } catch { Write-Error $_; exit 1 }"
if errorlevel 1 exit /b 1
if not exist "%FILE%" exit /b 1
echo Installing %~nx2...
start /wait "" "%FILE%" /install /quiet /norestart
set "RC=%errorlevel%"
if not "%RC%"=="0" if not "%RC%"=="3010" if not "%RC%"=="1638" exit /b %RC%
exit /b 0

:Failed
echo.
echo Repair did not complete. Check your internet connection, then run this file again as administrator.
echo Official download page: https://www.microsoft.com/zh-cn/download/details.aspx?id=30679
pause
exit /b 1

Windows 激活

  • WIN XP: MRX3F-47B9T-2487J-KWKMF-RPWBY
  • Win 10/11:38VFH-NMFFQ-VKW9D-4GJDG-BP2KM