#对于一些无人值守的设备,对win10系统进行一些优化
#避免在出现无法使用的情况
@echo off
REM 关闭防火墙
netsh advfirewall set allprofiles state off
REM 禁用自动更新
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /t REG_DWORD /d 1 /f
REM 禁用休眠和睡眠
powercfg -h off
powercfg -change -standby-timeout-dc 0
powercfg -change -standby-timeout-ac 0
REM 防止自动关闭网络
powercfg -change -standby-timeout-dc 0
powercfg -change -standby-timeout-ac 0
powercfg -change -hibernate-timeout-dc 0
powercfg -change -hibernate-timeout-ac 0
REM 防止自动关闭硬盘
powercfg -change -disk-timeout-dc 0
powercfg -change -disk-timeout-ac 0
REM 开启远程桌面
REG ADD "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
REM 禁用弹窗通知
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v EnableBalloonTips /t REG_DWORD /d 0 /f
REM 提高磁盘读写性能(可选)
REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Parameters" /v DisableDeleteNotification /t REG_DWORD /d 1 /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v SystemResponsiveness /t REG_DWORD /d 0 /f
:: 创建管理员用户
net user admin0 admin0 /add
net localgroup administrators admin0 /add
:: 更改计算机名称
set /p computername="请输入计算机名称: "
wmic computersystem where name="%COMPUTERNAME%" call rename name="%computername%"
echo 优化完成
pause