每次重灌系統都要手動調整 20~30 項服務啟動類型,既繁瑣又易出錯。Windows XP 內建的 sc.exe(Service Control)命令列工具,結合批次檔即可實現服務配置自動化,讓優化流程從「手工作業」進化為「一鍵完成」。
sc config 服務名稱 start= demand|auto|disabled(注意 start= 後必須有一個空格)sc start|stop 服務名稱(速度比 net start/stop 更快,可控制的服務也更多)sc delete 服務名稱(高風險操作,除非極度確定該服務非系統核心所需,否則不建議使用)sc config RemoteRegistry start= demand
sc stop RemoteRegistry
先在「服務」管理單元(services.msc)查明每項服務的「服務名稱」(非顯示名稱),再依需求撰寫批次指令。以下為筆者基於 XP SP2 的配置範例(未含自動更新、安全中心、防火牆):
sc config Alerter start= demand
sc config TrkWks start= demand
sc config helpsvc start= demand
sc config PolicyAgent start= demand
sc config dmserver start= demand
sc config WmdmPmSn start= demand
sc config Spooler start= demand
sc config RemoteRegistry start= demand
sc config NtmsSvc start= demand
sc config seclogon start= demand
sc config Schedule start= demand
sc config WebClient start= demand
sc config W32Time start= demand
sc config WZCSVC start= demand
sc config ERSvc start= demand
sc config Themes start= demand
sc config FastUserSwitchingCompatibility start= disabled
sc config Messenger start= disabled
sc config ProtectedStorage start= disabled
sc config SSDPSRV start= disabled
sc config TermService start= disabled
sc config ShellHWDetection start= disabled
sc stop W32Time
sc stop ShellHWDetection
sc stop TrkWks
sc stop helpsvc
sc stop dmserver
sc stop PolicyAgent
sc stop Spooler
sc stop RemoteRegistry
sc stop seclogon
sc stop Schedule
sc stop WZCSVC
sc stop ERSvc
sc stop Themes
sc stop FastUserSwitchingCompatibility
sc stop ProtectedStorage
sc stop SSDPSRV
sc stop WebClient
將上述指令存為 services.cmd,重灌後以系統管理員身分執行即可完成所有服務調整。
Spooler,視覺樣式需 Themes,不可盲目停用。TermService 設為 disabled 後需重開機才會停止,sc stop 無效。ProtectedStorage)。sc.exe 至 Win2000 同目錄下,即可使用相同批次檔。補充建議:參考《用我所用棄我所棄——Windows XP 服務詳解》(大眾軟體 2004 年 18、19 期)搭配實際環境微調,方能達成「精準瘦身」不踩雷。