中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 我修改的批处理用来修改系统服务,请多指教!
作者:
标题: 我修改的批处理用来修改系统服务,请多指教! 上一主题 | 下一主题
payxl
初级用户





积分 26
发帖 14
注册 2007-7-7
状态 离线
『楼 主』:  我修改的批处理用来修改系统服务,请多指教!

@echo off
title 系统服务自动优化
echo 系统服务自动优化
color 2c
:Alerter
echo 关闭Alerter
echo.
sc stop Alerter >nul
sc config Alerter start= demand >nul
:alg
echo.
echo 配置Application Layer Gateway Service
echo.
echo 您需要打开本服务吗?(Y/N/Q):
set alg=
set /p alg=
echo.
if /I "%alg%"=="" goto alg
if /I "%alg%"=="Y" sc start ALG >nul && sc config ALG start= auto >nul && echo 已经打开本服务!
if /I "%alg%"=="N" sc stop ALG >nul && sc config ALG start= demand >nul && echo 已经关闭本服务!
if /I "%alg%"=="Q" goto exit
echo.
:AppMgmt
echo 关闭Application Management
echo.
sc stop AppMgmt >nul
sc config AppMgmt start= demand >nul
:wuauserv
echo 配置Automatic Updates
echo.
echo 您需要打开Automatic Updates吗(Y/N/Q):
set au=
set /p au=
echo.
if /I "%au%"=="" goto wuauserv
if /I "%au%"=="Y" sc start wuauserv >nul && sc config wuauserv start= auto >nul && echo 已经打开本服务!
if /I "%au%"=="N" sc stop wuauserv >nul && sc config wuauserv start= demand >nul && echo 已经关闭本服务!
if /I "%au%"=="Q" goto exit
echo.
:BITS
echo 关闭Background Intelligent Transfer Service
echo.
sc stop BITS>nul
sc config BITS start= demand >nul
:ClipSrv
echo.
echo 关闭ClipBook
echo.
sc stop ClipSrv >nul
sc config ClipSrv start= demand >nul
:EventSystem
echo 您最好打开COM+ Event System
echo.
sc start EventSystem >nul
sc config EventSystem start= auto >nul
:COMSysApp
echo 关闭COM+ System Application
echo.
sc stop COMSysApp >nul
sc config COMSysApp start= demand >nul
:Browser
echo 配置Computer Browser
echo.
echo 您需要打开Computer Browser吗?如果你单机,请选择N (Y/N/Q):
set cb=
set /p cb=
echo.
if /I "%cb%"=="" goto Browser
if /I "%cb%"=="Y" sc start Browser >nul && sc config Browser start= auto >nul && echo 已经打开本服务!
if /I "%cb%"=="N" sc stop Browser >nul && sc config Browser start= demand >nul && echo 已经关闭本服务!
if /I "%cb%"=="Q" goto exit
echo.
:CryptSvc
echo 配置Cryptographic Services
echo.
echo 您需要打开Cryptographic Services吗?推荐选择自动运行(Y/N/Q):
set cs=
set /p cs=
echo.
if /I "%cs%"=="" goto CryptSvc
if /I "%cs%"=="Y" sc start CryptSvc >nul && sc config CryptSvc start= auto >nul && echo 已经打开本服务!
if /I "%cs%"=="N" sc stop CryptSvc >nul && sc config CryptSvc start= demand >nul && echo 已经关闭本服务!
if /I "%cs%"=="Q" goto exit
echo.
:DcomLaunch
echo 必须自动运行DcOM Server Process Launcher
echo.
sc start DcomLaunch >nul
sc config DcomLaunch start= auto >nul
:Dhcp
echo 配置DHCP Client
echo.
echo 您需要打开DHCP Client吗?(Y/N/Q):
set dh=
set /p dh=
echo.
if /I "%dh%"=="" goto Dhcp
if /I "%dh%"=="Y" sc start Dhcp >nul && sc config Dhcp start= auto >nul && echo 已经打开本服务!
if /I "%dh%"=="N" sc stop Dhcp >nul && sc config Dhcp start= demand >nul && echo 已经关闭本服务!
if /I "%dh%"=="Q" goto exit
echo.
:TrkWks
echo 关闭Distributed Link Tracking Client
echo.
sc stop TrkWks >nul
sc config TrkWks start= demand >nul
:Msdtc
echo 关闭Distributed Transaction Coordinator
echo.
sc stop Msdtc >nul
sc config Msdtc start= demand >nul
:Dnscache
echo 配置DNS Client
echo.
echo 您需要打开DNS Client吗?(Y/N/Q):
set dns=
set /p dns=
echo.
if /I "%dns%"=="" goto Dnscache
if /I "%dns%"=="Y" sc start Dnscache >nul && sc config Dnscache start= auto >nul && echo 已经打开本服务!
if /I "%dns%"=="N" sc stop Dnscache >nul && sc config Dnscache start= demand >nul && echo 已经关闭本服务!
if /I "%dns%"=="Q" goto exit
echo.
:Eventlog
echo 最好打开Event Log
echo.
sc start Eventlog >nul
sc config Eventlog start= auto >nul
:FUSC
echo 关闭Fast User Switching Compatibility
echo.
sc stop FastUserSwitchingCompatibility >nul
sc config FastUserSwitchingCompatibility start= demand >nul
:HttpFilter
echo 关闭HTTP SSL
echo.
sc stop HttpFilter >nul
sc config HttpFilter start= demand >nul
:HidServ
echo 关闭Human Interface Device Access
echo.
sc stop HidServ >nul
sc config HidServ start= demand >nul
:ImapiService
echo 关闭IMAPI CD-Burning COM Service
echo.
sc stop ImapiService >nul
sc config ImapiService start= demand >nul
:PolicyAgency
echo 您最好运行IPSEC Services
echo.
sc stop PolicyAgency >nul
sc config PolicyAgency start= demand >nul
:dmserver
echo 您最好运行logical Disk Manager
echo.
sc start dmserver >nul
sc config dmserver start= auto >nul
:dmadmin
echo 关闭Logical Disk Manager Administrative Service
echo.
sc stop dmadmin >nul
sc config dmadmin start= demand >nul
:Netlogon
echo 关闭Net Logon
echo.
sc stop Netlogon >nul
sc config  Netlogon start= demand >nul
:Netman
echo 关闭Network Connections
echo.
sc stop Netman >nul
sc config Netman start= demand >nul
:NetDDE
echo 禁用Network DDE
echo.
sc stop NetDDE >nul
sc config NetDDE start= disabled >nul
:NetDDEdsdm
echo 禁用Network DDE DSDM
echo.
sc stop NetDDEdsdm >nul
sc config NetDDEdsdm start= disabled >nul
:Nla
echo 关闭Network Location Awareness (NLA)
echo.
sc stop Nla >nul
sc config Nla start= demand >nul
:xmlprov
echo 关闭Network Provisioning Service
echo.
sc stop xmlprov >nul
sc config xmlprov start= demand >nul
:NtLmSsp
echo 关闭NT LM Security Support Provider
echo.
sc stop NtLmSsp >nul
sc config NtLmSsp start= demand >nul
:NVSvc
echo 禁用NVIDIA Display Driver Service
echo.
sc stop NVSvc >nul
sc config NVSvc start= disabled >nul
:SysmonLog
echo 关闭Performance Logs and Alerts
echo.
sc stop SysmonLog >nul
sc config SysmonLog start= demand >nul
:PlugPlay
echo 您最好运行Plug and Play
echo.
sc start PlugPlay >nul
sc config PlugPlay start= auto >nul
:WmdmPmSN
echo 关闭Portable Media Serial Number Service
echo.
sc stop WmdmPmSN >nul
sc config WmdmPmSN start= demand >nul
:Spooler
echo 配置Print Spooler
echo.
echo 您有打印机吗?您需要打开Print Spooler吗?(Y/N/Q):
set ps=
set /p ps=
echo.
if /I "%ps%"=="" goto Spooler
if /I "%ps%"=="Y" sc start Spooler >nul && sc config Spooler start= auto >nul && echo 已经打开本服务!
if /I "%ps%"=="N" sc stop Spooler >nul && sc config Spooler start= demand >nul && echo 已经关闭本服务!
if /I "%ps%"=="Q" goto exit
echo.
:ProtectedStorage
echo 您最好运行Protected Storage
echo.
sc start ProtectedStorage >nul
sc config ProtectedStorage start= auto >nul
:RSVP
echo 禁用QoS RSVP
echo.
sc stop RSVP >nul
sc config RSVP start= disabled >nul
:RasAuto
echo 关闭Remote Access Auto Connection Manager
echo.
sc stop RasAuto >nul
sc config RasAuto start= demand >nul
:RasMan
echo 关闭Remote Access Connection Manager
echo.
sc stop RasMan >nul
sc config RasMan start= demand >nul
:RDSessMgr
echo 关闭Remote Desktop Help Session Manager
echo.
sc stop RDSessMgr >nul
sc config RDSessMgr start= demand >nul
:RemoteRegistry
echo 禁用Remote Registry
echo.
sc stop RemoteRegistry >nul
sc config RemoteRegistry start= disabled >nul
:RpcSs
echo 必须运行Remote Procedure Call (RPC)
echo.
sc start RpcSs >nul
sc config RpcSs start= auto >nul
:RpcLocator
echo 关闭Remote Procedure Call (RPC) Locator
echo.
sc stop RpcLocator >nul
sc config RpcLocator start= demand >nul
:RemoteAccess
echo 禁用Routing and Remote Access
echo.
sc stop RemoteAccess >nul
sc config RemoteAccess start= disabled >nul
:seclogon
echo 您最好运行Secondary Logon
echo.
sc start seclogon >nul
sc config seclogon start= auto >nul
:SamSs
echo 您最好运行Security Accounts Manager
echo.
sc start SamSs >nul
sc config SamSs start= auto >nul
:wscsvc
echo 关闭Security Center
echo.
sc stop wscsvc >nul
sc config wscsvc start= demand >nul
:ShellHWDetection
echo 您最好运行Shell Hardware Detection
echo.
sc start ShellHWDetection >nul
sc config ShellHWDetection start= auto >nul
:SCardSvr
echo 禁用Smart Card
echo.
sc stop SCardSvr >nul
sc config SCardSvr start= disabled >nul
:SSDPSRV
echo 您最好运行SSDP Discovery Service
echo.
sc stop SSDPSRV >nul
sc config SSDPSRV start= demand >nul
:SENS
echo 您最好运行System Event Notification
echo.
sc start SENS >nul
sc config SENS start= auto >nul
:srservice
echo 配置System Restore Service
echo.
echo 您需要打开System Restore Service(系统还原)吗?(Y/N/Q):
set sr=
set /p sr=
echo.
if /I "%sr%"=="" goto srservice
if /I "%sr%"=="Y" sc start srservice >nul && sc config srservice start= auto >nul && echo 已经打开本服务!
if /I "%sr%"=="N" sc stop srservice >nul && sc config srservice start= demand >nul && echo 已经关闭本服务!
if /I "%sr%"=="Q" goto exit
echo.
:Schedule
echo 您最好运行Task Scheduler
echo.
sc start Schedule >nul
sc config Schedule start= auto >nul
:LmHosts
echo 您最好运行TCP/IP NetBIOS Helper
echo.
sc start LmHosts >nul
sc config LmHosts start= auto >nul
:TapiSrv
echo 关闭Telephony
echo.
sc stop TapiSrv >nul
sc config TapiSrv start= demand >nul
:TermService
echo 您最好运行Terminal Services
echo.
sc start TermService >nul
sc config TermService start= demand >nul
:Themes
echo 配置Themes
echo.
echo 您需要打开Themes(主题)吗?(Y/N/Q):
set th=
set /p th=
echo.
if /I "%th%"=="" goto Themes
if /I "%th%"=="Y" sc start Themes >nul && sc config Themes start= auto >nul && echo 已经打开本服务!
if /I "%th%"=="N" sc stop Themes >nul && sc config Themes start= demand >nul && echo 已经关闭本服务!
if /I "%th%"=="Q" goto exit
echo.
:upnphost
echo 关闭Universal Plug and Play Device Host
echo.
sc stop upnphost >nul
sc config upnphost start= demand >nul
:UPS
echo 禁用UPS
echo.
sc stop UPS >nul
sc config UPS start= disabled >nul
:WebClient
echo 您最好运行WebClient
echo.
sc start WebClient >nul
sc config WebClient start= auto >nul
:AudioSrv
echo 您最好运行Windows Audio
echo.
sc start AudioSrv >nul
sc config AudioSrv start= auto >nul
:SharedAccess
echo 配置Windows Firewall/Internet Connection Sharing (ICS)
echo.
echo 您需要打开Windows Firewall/Internet Connection Sharing (ICS)(防火墙)吗?(Y/N/Q):
set ics=
set /p ics=
echo.
if /I "%ics%"=="" goto SharedAccess
if /I "%ics%"=="Y" sc start SharedAccess >nul && sc config SharedAccess start= auto >nul && echo 已经打开本服务!
if /I "%ics%"=="N" sc stop SharedAccess >nul && sc config SharedAccess start= demand >nul && echo 已经关闭本服务!
if /I "%ics%"=="Q" goto exit
echo.
:stisvc
echo 关闭Windows Image Acquisition (WIA)-为扫描仪和照相机提供图像捕获。
echo.
sc stop stisvc >nul
sc config stisvc start= demand >nul
:MSIServer
echo 关闭Windows Installer
echo.
sc stop MSIServer >nul
sc config MSIServer start= demand >nul
:winmgmt
echo 您最好运行Windows Management Instrumentation
echo.
sc start winmgmt >nul
sc config winmgmt start= auto >nul
:Wmi
echo 关闭Windows Management Instrumentation Driver Extensions-与驱动程序间交换系统管理信息。
echo.
sc stop Wmi >nul
sc config Wmi start= demand >nul
:W32Time
echo 禁用Windows Time
echo.
sc stop W32Time >nul
sc config W32Time start= disabled >nul
:UMWdf
echo 关闭Windows User Mode Driver Framework-启用 Windows 用户模式驱动程序。
echo.
sc stop UMWdf >nul
sc config UMWdf start= demand >nul
:WZCSVC
echo 配置Wireless Zero Configuration-为您的 802.11 适配器提供自动配置
echo.
echo 您需要打开WWireless Zero Configuration吗?(Y/N/Q):
set wzc=
set /p wzc=
echo.
if /I "%wzc%"=="" goto WZCSVC
if /I "%wzc%"=="Y" sc start WZCSVC >nul && sc config WZCSVC start= auto >nul && echo 已经打开本服务!
if /I "%wzc%"=="N" sc stop WZCSVC >nul && sc config WZCSVC start= demand >nul && echo 已经关闭本服务!
if /I "%wzc%"=="Q" goto exit
echo.
:WmiApSrv
echo 关闭WMI Performance Adapter-从 WMI HiPerf  提供程序提供性能库信息。
echo.
sc stop WmiApSrv >nul
sc config WmiApSrv start= demand >nul
echo 服务优化完毕!按任意键退出!
pause >nul
exit
:exit
echo 服务优化中断!按任意键退出!
pause >nul
exit

2007-7-8 23:39
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
payxl
初级用户





积分 26
发帖 14
注册 2007-7-7
状态 离线
『第 2 楼』:  

就是有些复杂,不知道哪位版主能改用for进行精简

2007-7-8 23:46
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
jsb2008
初级用户





积分 43
发帖 22
注册 2007-8-21
状态 离线
『第 3 楼』:  

先看看再说......

2007-8-21 14:11
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
jsb2008
初级用户





积分 43
发帖 22
注册 2007-8-21
状态 离线
『第 4 楼』:  

把内容复制到记事本中保存为.bat文件双击运行即可!

2007-8-31 14:32
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
wwwzhuce
初级用户





积分 20
发帖 10
注册 2007-8-26
状态 离线
『第 5 楼』:  

楼主辛苦了!

2007-9-1 15:35
查看资料  发短消息 网志   编辑帖子  回复  引用回复
abqqe
新手上路





积分 8
发帖 4
注册 2008-9-23
状态 离线
『第 6 楼』:  

要选择 Y Or N ,怎么算是自动呢? 最好就做好一点咯

2008-11-28 18:35
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: