[英]How to set up a windows service to run on system shut-down by using the command line
[英]How to change start up type of a windows service using command line
我的重點是Web服務器。
Apache Web服務器確實以自動類型( httpd -k install
)安裝服務,Apache沒有提供以手動方式安裝服務的參數(如MySQL: mysqld --install-manual
)。
我讀了一些關於SC ( C:\\Windows\\System32\\sc.exe
)並試圖用SC改變它,但我做不到。 那么解決方案是什么?
SC應該能夠處理這個,你有任何錯誤嗎?
這會將名為“apache”的服務的啟動類型設置為手動:
SC \\computername CONFIG apache start= demand
我只是在遠程機器上應用相同的目的 - CHANGE WIN SERVICE STARTUP METHOD--
C:\MrCMD> REG QUERY \\RemoteHostName\HKLM\SYSTEM\CurrentControlSet\Services\WUAUServ
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WUAUServ
Type REG_DWORD 0x20
Start REG_DWORD 0x2
ErrorControl REG_DWORD 0x1
ImagePath REG_EXPAND_SZ %systemroot%\system32\svchost.exe -k netsvcs
DisplayName REG_SZ Automatic Updates
ObjectName REG_SZ LocalSystem
Description REG_SZ Enables the download and installation of Windows updates. If this service is disabled, this computer will not be able to use the Automatic Updates feature or the Windows Update Web site.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WUAUServ\Parameters
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WUAUServ\Security
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WUAUServ\Enum
┌─────────────────────────────────────┐
│ Executed Mon 01/14/2013 14:27:15.31 │ As [MrCMD]
└─────────────────────────────────────┘
C:\MrCMD> REG ADD \\RemoteHostName\HKLM\SYSTEM\CurrentControlSet\Services\wuauserv /V Start /T REG_DWORD /d 0x3
Value Start exists, overwrite(Yes/No)? y
The operation completed successfully.
┌─────────────────────────────────────┐
│ Executed Mon 01/14/2013 14:29:57.72 │ As [MrCMD]
└─────────────────────────────────────┘
C:\MrCMD> REG QUERY \\RemoteHostName\HKLM\SYSTEM\CurrentControlSet\Services\WUAUServ
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WUAUServ
Type REG_DWORD 0x20
Start REG_DWORD 0x3
ErrorControl REG_DWORD 0x1
ImagePath REG_EXPAND_SZ %systemroot%\system32\svchost.exe -k netsvcs
DisplayName REG_SZ Automatic Updates
ObjectName REG_SZ LocalSystem
Description REG_SZ Enables the download and installation of Windows updates. If this service is disabled, this computer will not be able to use the Automatic Updates feature or the Windows Update Web site.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WUAUServ\Parameters
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WUAUServ\Security
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WUAUServ\Enum
┌─────────────────────────────────────┐
│ Executed Mon 01/14/2013 14:30:37.80 │ As [MrCMD]
└─────────────────────────────────────┘
那是所有人.. :)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.