未名Q

此生若能得幸福安稳,谁又愿颠沛流离。

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: :: 订阅 订阅 :: 管理 ::

Batch

@echo off
rem  get current date and time
for /f "tokens=1,2,3 delims=-/. " %%j in ('Date /T') do set FILENAME=srv_%%j%%k%%l
for /f "tokens=1,2 delims=: " %%j in ('TIME /T') do set FILENAME=%FILENAME%-%%j%%k_%RANDOM%.ba_

rem get all service name
sc query type= service state= all|findstr /r /C:"SERVICE_NAME:" >tmpsrv.txt
echo Save Service Start State In %FILENAME%

rem save service start state into batch file
rem

echo @echo off >"%FILENAME%"
echo echo Restore The Service Start State Saved At %TIME% %DATE% form %USERDOMAIN% >>"%FILENAME%"
echo pause >>"%FILENAME%"

for /f "tokens=2 delims=:" %%j in (tmpsrv.txt) do (
sc qc %%j|findstr START_TYPE >tmpstype.txt
for /f "tokens=4 delims=:_ " %%s in (tmpstype.txt) do echo sc config %%j start= %%s >>"%FILENAME%"
)
echo exit >>"%FILENAME%"

del tmpsrv.txt
del tmpstype.txt
exit

Windows XP SP3 Pro Chs

@echo off
pause
sc config  Alerter start= DISABLED 
sc config  ALG start= DEMAND 
sc config  AppMgmt start= DEMAND 
sc config  AudioSrv start= AUTO 
sc config  BITS start= DEMAND 
sc config  Browser start= AUTO 
sc config  CiSvc start= DEMAND 
sc config  ClipSrv start= DISABLED 
sc config  COMSysApp start= DEMAND 
sc config  CryptSvc start= AUTO 
sc config  DcomLaunch start= AUTO 
sc config  Dhcp start= AUTO 
sc config  dmadmin start= DEMAND 
sc config  dmserver start= AUTO 
sc config  Dnscache start= AUTO 
sc config  Dot3svc start= DEMAND 
sc config  EapHost start= DEMAND 
sc config  ERSvc start= AUTO 
sc config  Eventlog start= AUTO 
sc config  EventSystem start= DEMAND 
sc config  FastUserSwitchingCompatibility start= DEMAND 
sc config  helpsvc start= AUTO 
sc config  HidServ start= AUTO 
sc config  hkmsvc start= DEMAND 
sc config  HTTPFilter start= DEMAND 
sc config  ImapiService start= DEMAND 
sc config  LanmanServer start= AUTO 
sc config  lanmanworkstation start= AUTO 
sc config  LmHosts start= AUTO 
sc config  Messenger start= DISABLED 
sc config  mnmsrvc start= DEMAND 
sc config  MSDTC start= DEMAND 
sc config  MSIServer start= DEMAND 
sc config  napagent start= DEMAND 
sc config  NetDDE start= DISABLED 
sc config  NetDDEdsdm start= DISABLED 
sc config  Netlogon start= DEMAND 
sc config  Netman start= DEMAND 
sc config  Nla start= DEMAND 
sc config  NtLmSsp start= DEMAND 
sc config  NtmsSvc start= DEMAND 
sc config  PlugPlay start= AUTO 
sc config  PolicyAgent start= AUTO 
sc config  ProtectedStorage start= AUTO 
sc config  RasAuto start= DEMAND 
sc config  RasMan start= DEMAND 
sc config  RDSessMgr start= DEMAND 
sc config  RemoteAccess start= DISABLED 
sc config  RemoteRegistry start= AUTO 
sc config  RpcLocator start= DEMAND 
sc config  RpcSs start= AUTO 
sc config  RSVP start= DEMAND 
sc config  SamSs start= AUTO 
sc config  SCardSvr start= DEMAND 
sc config  Schedule start= AUTO 
sc config  seclogon start= AUTO 
sc config  SENS start= AUTO 
sc config  SharedAccess start= AUTO 
sc config  ShellHWDetection start= AUTO 
sc config  Spooler start= AUTO 
sc config  srservice start= AUTO 
sc config  SSDPSRV start= DEMAND 
sc config  stisvc start= DEMAND 
sc config  SwPrv start= DEMAND 
sc config  SysmonLog start= DEMAND 
sc config  TapiSrv start= DEMAND 
sc config  TermService start= DEMAND 
sc config  Themes start= AUTO 
sc config  TlntSvr start= DISABLED 
sc config  TrkWks start= AUTO 
sc config  UMWdf start= AUTO 
sc config  upnphost start= DEMAND 
sc config  UPS start= DEMAND 
sc config  VSS start= DEMAND 
sc config  W32Time start= AUTO 
sc config  WebClient start= AUTO 
sc config  winmgmt start= AUTO 
sc config  WmdmPmSN start= DEMAND 
sc config  Wmi start= DEMAND 
sc config  WmiApSrv start= DEMAND 
sc config  wscsvc start= AUTO 
sc config  wuauserv start= AUTO 
sc config  WZCSVC start= AUTO 
sc config  xmlprov start= DEMAND 
exit
Windows Server 2003

Windows 7

posted on 2010-12-28 21:03  未名Q  阅读(364)  评论(0编辑  收藏  举报