服务优化一找一大堆,
这是我自己写的:- @echo off
- setlocal enabledelayedexpansion
-
- ::查看已运行的服务
- echo.查看已运行的服务...
- sc query type^= service|findstr "SERVICE_NAME: DISPLAY_NAME:">tmpinsrv.txt
- start "notepad.exe" tmpinsrv.txt
-
- :: 枚举所有服务
- cd.>tmpsrv.txt
- sc query type^= service state^= all|findstr /r /C:"SERVICE_NAME:">>tmpsrv.txt
- echo 正在运行 稍后...
- ::设置启动类型:关闭
- for /f "tokens=2 delims= " %%a in (tmpsrv.txt) do sc config %%a start= DISABLED>nul
- ::for /f "tokens=2 delims= " %a in (tmpsrv.txt) do sc config %a start= AUTO>nul
-
- ::打开必要的服务:
- (rem 显示名: remote Procedure Call (RPC)
- sc config RpcSs start= AUTO
- rem 显示名: Plug and Play (随插随用)
- sc config PlugPlay start= AUTO
- sc config AudioSrv start= AUTO
- sc config Eventlog start= AUTO
- rem 显示名: Network Connections
- sc config Netman start= DEMAND
- rem 显示名: Telephony (电话语音)
- sc config TapiSrv start= DEMAND
- rem 显示名: Remote Access Connection Manager(PPPOE)
- sc config RasMan start= DEMAND
- rem 显示名: Windows Installer (Windows 安装程序)
- sc config MSIServer start= DEMAND
- rem 显示名: Telnet
- sc config TlntSvr start= DEMAND
- rem 显示名: NVIDIA Display Driver Service (N显卡驱动)
- sc config NVSvc start= AUTO
- rem 显示名: Kaspersky Internet Security 7.0 (卡巴斯基)
- sc config AVP start= DEMAND
- )>nul
-
- set /p "choice=需要打印服务?(y|n)"
- if /i "%choice%"=="y" (sc config Spooler start= AUTO)
- set /p "choice=需要使用扫描仪/摄像头?(y|n)"
- if /i "%choice%"=="y" (sc config stisvc start= DEMAND)
- set /p "choice=需要DCOM/COM+服务?(y|n)"
- if /i "%choice%"=="y" (sc config DcomLaunch start= AUTO & sc config EventSystem start= DEMAND)
- set /p "choice=IP地址自动获得(DHCP)?(y|n)"
- if /i "%choice%"=="y" (sc config dhcp start= AUTO)
- set /p "choice=ASP.NET 玩大型网游?(y|n)"
- if /i "%choice%"=="y" (sc config aspnet_state start= DEMAND)
-
- echo 任务结束
- pause>nul
- del /q tmpsrv.txt tmpinsrv.txt
- exit /b
复制代码
|