China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-24 16:33
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] System service optimization batch processing, a New Year gift for everyone! View 4,347 Replies 17
Original Poster Posted 2007-02-12 06:51 ·  中国 广东 湛江 电信
高级用户
★★★
Credits 959
Posts 311
Joined 2006-04-11 14:08
20-year member
UID 53665
Gender Male
From 广东-LianJiang
Status Offline
I have a friend who is very lazy. The day before yesterday, he asked me to make a batch script for optimizing Windows 2003 system services. So I take it as a New Year gift for everyone. Please forgive me.
I wonder if there is a return gift? Hehe. Adding points is like a red envelope!


Service Optimization.bat
@ECHO %dbg% OFF
::Code by qasa Copyright@qknet 11:36 2007-2-11
::E-mail:qknet@21cn.com
title Automatically Set Optimized Services Author:qasa
if "%1"=="/?" (
echo.&echo Please add the services you want to set in the newly created Server.ini. The format is as follows:
echo ^<Service Name^>^|^<1^|2^|3^>^|^<Comment^>
echo 1 is automatic; 2 is manual; 3 is disabled
echo.&echo Eg:&echo w32time^|3
echo.&echo The above means that the Windows Time service is set to disabled.
echo Comments can be omitted.
goto :eof
)
mode con cols=60 lines=15&color c
if not exist server.ini (
echo You don't have the service configuration file -- Server.ini, please check! ! !
echo.&echo Please add the services you want to set in Server.ini. The format is as follows:
echo ^<Service Name^>^|^<1^|2^|3^>^|^<Comment^>
echo 1 is automatic; 2 is manual; 3 is disabled
echo.&echo Eg:&echo w32time^|3
echo.&echo The above means that the Windows Time service is set to disabled.
echo Comments can be omitted.
pause>nul
cd.>Server.ini
goto :eof
)
echo Please wait, setting services for you......
for /f "tokens=1,2 delims=|" %%i in (server.ini) do (
if %%j equ 3 sc config %%i start= disabled >nul 2>nul
if %%j equ 2 sc config %%i start= demand >nul 2>nul
if %%j equ 1 sc config %%i start= auto >nul 2>nul
)
echo.&echo.&echo.&echo.
echo *****************************
echo ** Service setup completed! ! ! **
echo *****************************
echo.&set/p a= It is recommended to restart to take effect! ! ! Press R key to restart:
if /i %a% equ r shutdown -r -t 0
exit /b


Server.ini
AeLookupSvc|1
Alerter|3
ALG|3
AppMgmt|2
AudioSrv|1
BITS|3
Browser|3
CiSvc|3
ClipSrv|3
COMSysApp|2
CryptSvc|2
DcomLaunch|1
Dfs|2
Dhcp|2
dmadmin|2
dmserver|1
Dnscache|2
ERSvc|3
Eventlog|1
EventSystem|2
helpsvc|3
HidServ|3
HTTPFilter|2
ImapiService|3
IsmServ|3
kdc|3
lanmanserver|3
lanmanworkstation|1
LicenseService|3
LmHosts|3
Messenger|3
mnmsrvc|3
MSDTC|3
MSIServer|2
NetDDE|3
NetDDEdsdm|3
Netlogon|3
Netman|2
Nla|3
NtFrs|2
NtLmSsp|3
NtmsSvc|2
ose|2
PlugPlay|1
PolicyAgent|1
ProtectedStorage|1
RasAuto|2
RasMan|2
RDSessMgr|3
remoteAccess|3
remoteRegistry|3
RpcLocator|3
RpcSs|1
RSoPProv|2
sacsvr|3
SamSs|1
SCardSvr|3
Schedule|1
seclogon|1
SENS|1
SharedAccess|2
ShellHWDetection|1
Spooler|3
stisvc|2
swprv|3
SysmonLog|3
TapiSrv|2
TermService|1
Themes|3
TrkSvr|3
TrkWks|3
Tssdis|3
UMWdf|2
UPS|3
vds|2
VSS|3
W32Time|3
WebClient|1
WinHttpAutoProxySvc|2
winmgmt|1
WmdmPmSN|3
Wmi|2
WmiApSrv|3
WZCSVC|3
xmlprov|2


Upload another configuration file for Windows XP with comments.

[ Last edited by qasa on 2007-2-14 at 02:59 PM ]
Attachments
服务优化.rar (1.82 KiB, Credits to download 1 pts, Downloads: 91)
ServerXP.rar (3.3 KiB, Credits to download 1 pts, Downloads: 86)
κχυμγνξοθπρωψιαδλεηφβτζσ┬╀┾┳┞┯┰┱┣┲┳╂╁│├┟┭┠这是什么??这就是我的人生
Floor 2 Posted 2007-02-12 07:14 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Just one line: sc config
Floor 3 Posted 2007-02-12 12:07 ·  中国 广东 湛江 电信
高级用户
★★★
Credits 959
Posts 311
Joined 2006-04-11 14:08
20-year member
UID 53665
Gender Male
From 广东-LianJiang
Status Offline
Originally posted by vkill at 2007-2-12 07:14:
Just one sentence: sc config


Well, yes, I think it's just using sc config. It's simple and easy to use, isn't it better? Why must it be complicated? Setting services this way is more convenient than setting them manually each time, isn't it?

So don't underestimate a single sc config; it's practical enough
κχυμγνξοθπρωψιαδλεηφβτζσ┬╀┾┳┞┯┰┱┣┲┳╂╁│├┟┭┠这是什么??这就是我的人生
Floor 4 Posted 2007-02-12 23:27 ·  中国 浙江 宁波 电信
初级用户
Credits 38
Posts 19
Joined 2006-10-22 23:11
19-year member
UID 67763
Gender Male
Status Offline
sc config. Learned, thanks
Floor 5 Posted 2007-02-13 01:23 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Simplify directly:

AeLookupSvc|1
Alerter|3
ALG|3
AppMgmt|2

to

AeLookupSvc|auto
Alerter|disabled
ALG|disabled
AppMgmt|demand

Modify:

for /f "tokens=1,2 delims=|" %%i in (server.ini) do (
if %%j equ 3 sc config %%i start= disabled >nul 2>nul
if %%j equ 2 sc config %%i start= demand >nul 2>nul
if %%j equ 1 sc config %%i start= auto >nul 2>nul
)

to:

for /f "tokens=1,2 delims=|" %%i in (server.ini) do (
sc config %%i start= %%j >nul 2>nul
)

This makes the content of server.ini more intuitive
Floor 6 Posted 2007-02-13 02:26 ·  中国 广东 湛江 电信
高级用户
★★★
Credits 959
Posts 311
Joined 2006-04-11 14:08
20-year member
UID 53665
Gender Male
From 广东-LianJiang
Status Offline

Re: zh159

I initially also prepared to write directly with letters as you did, but later due to the ease of understanding and operational issues, I still found numbers simpler. When making changes, there's no need to remember letters, and I was afraid that letters might be more error-prone than numbers. Hehe, this might also be a personal view, and it's still to be proven in practice.
So I emphasized the help aspect in the statement to let users understand the operation.


[ Last edited by qasa on 2007-2-13 at 02:31 AM ]
κχυμγνξοθπρωψιαδλεηφβτζσ┬╀┾┳┞┯┰┱┣┲┳╂╁│├┟┭┠这是什么??这就是我的人生
Floor 7 Posted 2007-02-15 13:07 ·  中国 广东 湛江 电信
高级用户
★★★
Credits 959
Posts 311
Joined 2006-04-11 14:08
20-year member
UID 53665
Gender Male
From 广东-LianJiang
Status Offline
Now an optimized service (Server.ini) for WinXP has been sorted out for your reference, with comments.
κχυμγνξοθπρωψιαδλεηφβτζσ┬╀┾┳┞┯┰┱┣┲┳╂╁│├┟┭┠这是什么??这就是我的人生
Floor 8 Posted 2007-02-15 13:48 ·  中国 广东 深圳 电信
初级用户
★★
Credits 135
Posts 64
Joined 2006-12-20 04:35
19-year member
UID 74003
Gender Male
Status Offline
The article is very good, thank you!! Collected!!!
Floor 9 Posted 2007-03-05 03:23 ·  中国 广东 深圳 龙岗区 电信
新手上路
Credits 9
Posts 6
Joined 2006-12-19 02:58
19-year member
UID 73904
Gender Male
From uiui
Status Offline
BAT is a good thing!!!!!!!!!!!!!!!
Floor 10 Posted 2007-03-06 06:11 ·  中国 湖南 娄底 电信
初级用户
Credits 28
Posts 11
Joined 2006-11-05 21:22
19-year member
UID 69699
Gender Male
Status Offline
Why didn't the service change after I ran it?

My Server.ini is as follows:
Adobe LM Service|2
Alerter|3
Application Layer Gateway Service|3
Application Management|2
Automatic Updates|1
Background Intelligent Transfer Service|2
ClipBook|3
COM+ Event System|2
COM+ System Application|2
Computer Browser|2
Cryptographic Services|2
DCOM Server Process Launcher|1
DHCP Client|1
Distributed Link Tracking Client|2
Distributed Transaction Coordinator|2
DNS Client|2
Error Reporting Service|3
Event Log|1
Fast User Switching Compatibility|2
Help and Support|2
HID Input Service|1
HTTP SSL|2

Solved, thank you

[ Last edited by mqi on 2007-3-7 at 02:55 AM ]
Floor 11 Posted 2007-03-07 01:11 ·  中国 广西 柳州 电信
初级用户
Credits 83
Posts 39
Joined 2006-12-22 09:55
19-year member
UID 74267
Gender Male
Status Offline
I think it's better to just use SC config directly, no need to be so troublesome
Floor 12 Posted 2007-03-07 09:20 ·  中国 上海 电信
初级用户
Credits 25
Posts 12
Joined 2007-03-01 04:09
19-year member
UID 80443
Gender Male
Status Offline
Thanks! Learning!
Floor 13 Posted 2007-03-08 13:00 ·  中国 广东 河源 电信
新手上路
Credits 8
Posts 4
Joined 2007-03-05 02:58
19-year member
UID 80797
Gender Male
Status Offline
Thank you! Learned it!
Floor 14 Posted 2007-03-09 10:08 ·  中国 广东 中山 电信
初级用户
Credits 128
Posts 16
Joined 2007-01-26 04:00
19-year member
UID 77697
Gender Male
Status Offline
Collected~~ Thanks!
Floor 15 Posted 2007-03-09 21:47 ·  中国 广东 东莞 电信
新手上路
Credits 18
Posts 8
Joined 2007-02-24 14:55
19-year member
UID 80084
Gender Male
Status Offline
Learned something, thanks
Forum Jump: