怎样用脚本启用系统快速启动?

wen 实用脚本 1

本文目录导读:

怎样用脚本启用系统快速启动?

  1. Windows 系统快速启动脚本方法
  2. 注意事项
  3. 检查快速启动状态

我来详细介绍如何通过脚本启用Windows系统的快速启动功能。

Windows 系统快速启动脚本方法

方法1:PowerShell 脚本

# 启用快速启动
# 以管理员身份运行此脚本
# 方法1:通过注册表启用
try {
    # 设置快速启动注册表值
    Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" `
                     -Name "HiberbootEnabled" `
                     -Value 1 `
                     -Type DWord
    # 同时确保休眠功能已启用(快速启动需要休眠)
    powercfg /hibernate on
    Write-Host "✓ 快速启动已成功启用" -ForegroundColor Green
} catch {
    Write-Host "✗ 启用失败: $($_.Exception.Message)" -ForegroundColor Red
}
# 验证状态
$status = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" `
                           -Name "HiberbootEnabled" -ErrorAction SilentlyContinue
if ($status.HiberbootEnabled -eq 1) {
    Write-Host "✓ 验证:快速启动已开启" -ForegroundColor Green
} else {
    Write-Host "✗ 验证:快速启动未开启" -ForegroundColor Red
}

方法2:CMD 批处理脚本

保存为 enable_fast_startup.bat,并以管理员身份运行

@echo off启用系统快速启动
cd /d %~dp0
:: 检查管理员权限
net session >nul 2>&1
if %errorLevel% neq 0 (
    echo [!] 请以管理员身份运行此脚本
    pause
    exit /b 1
)
echo ================================
echo     启用Windows快速启动
echo ================================
:: 启用休眠(快速启动依赖休眠)
echo [*] 启用休眠功能...
powercfg /hibernate on
if %errorLevel% equ 0 (
    echo [+] 休眠已启用
) else (
    echo [!] 休眠启用失败,请检查系统支持
)
:: 启用快速启动
echo [*] 启用快速启动...
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 1 /f
if %errorLevel% equ 0 (
    echo [+] 快速启动已启用
) else (
    echo [!] 快速启动启用失败
)
echo.
echo ================================
echo     当前快速启动状态
echo ================================
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled 2>nul
echo.
echo [-] 按任意键退出...
pause >nul

方法3:禁用快速启动的脚本

如需禁用,可以使用以下脚本:

PowerShell 禁用脚本:

# 禁用快速启动
# 以管理员身份运行
try {
    Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" `
                     -Name "HiberbootEnabled" `
                     -Value 0 `
                     -Type DWord
    # 也可以选择关闭休眠
    # powercfg /hibernate off
    Write-Host "✓ 快速启动已禁用" -ForegroundColor Yellow
} catch {
    Write-Host "✗ 操作失败: $($_.Exception.Message)" -ForegroundColor Red
}

CMD 禁用脚本:

@echo off禁用系统快速启动
net session >nul 2>&1
if %errorLevel% neq 0 (
    echo [!] 请以管理员身份运行
    pause
    exit /b 1
)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f
echo [*] 快速启动已禁用
pause

注意事项

  1. 管理员权限:所有脚本必须以管理员身份运行
  2. 系统要求:需要支持休眠功能的系统(Windows 8/8.1/10/11)
  3. 休眠文件:启用快速启动会在C盘创建hiberfil.sys文件(约占物理内存的40-75%)
  4. 硬件兼容性:某些硬件或驱动可能影响快速启动功能

检查快速启动状态

查看当前状态的PowerShell命令:

Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" `
                 -Name "HiberbootEnabled"

如果返回值为:

  • 1:快速启动已启用
  • 0:快速启动已禁用

选择适合你需求的脚本,并根据需要调整参数即可。

抱歉,评论功能暂时关闭!