Sc create

內容介紹,語法,參數說明,備註,示例,

內容介紹


Sc create 是WindowsDOS命令,用於創建Windows服務。適用於:Windows 7,Windows Server 2003,Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2,Windows Server 2008, Windows Server 2008 R2,Windows Vista

語法


sc [<ServerName>] create [<ServiceName>] [type= {own | share | kernel | filesys | rec | interact type= {own | share}}] [start= {boot | system | auto | demand | disabled}] [error= {normal | severe | critical | ignore}] [binpath= <BinaryPathName>] [group= <LoadOrderGroup>] [tag= {yes | no}] [depend= <dependencies>] [obj= {<AccountName> | <ObjectName>}] [displayname= <DisplayName>] [password= <Password>]

參數說明


<ServerName>:指定服務所在的遠程服務器的名稱。該名稱必須使用通用命名約定(UNC)格式(例如,\\ myserver的)。要在本地運行SC.exe,請忽略此參數。
<ServiceName>:
指定服務名返回getkeyname操作。
指定服務類型。默認設定為type= own。
type= {own | share | kernel | filesys | rec | interact type= {own | share}}:
own - 指定該服務運行在自己的進程。它不與其他服務共享執行檔。這是默認設定。
share - 指定的服務作為一個共享的進程中運行。它與其他服務共享一個執行檔。
kernel - 指定的驅動程式。
filesys - 指定檔案系統驅動程式。
REC - 指定檔案系統認可的驅動程式(標識在計算機上使用的檔案系統)。
interact - 指定該服務可以與桌面互動,接收用戶的輸入。互動服務必須在LocalSystem帳戶下運行。必須使用此類型的 type= own 或 type= shared.。使用type= interact 本身會產生“參數無效”的錯誤。
start= {boot | system | auto | demand | disabled}:
指定服務的啟動類型。默認設定為 start = demand。
system - 指定引導載入程式載入的設備驅動程式。
auto - 指定的設備驅動程式在核心初始化開始。
demand - 指定的服務,必須手動啟動。這是默認值,如果沒有指定開始。
disabled - 指定的服務無法啟動。要啟動一個禁用的服務,把啟動類型更改為其他值。
error= {normal | severe | critical | ignore}:
如果服務失敗,當計算機啟動時,指定的錯誤的嚴重程度。默認設定是 error= normal。
normal- 指定錯誤記錄。顯示一個訊息框,通知用戶服務啟動失敗。將繼續啟動。這是默認設定。
severe - 指定記錄錯誤(如果可能)。計算機嘗試重新啟動的最後一個已知的良好配置。這可能導致計算機能夠重新啟動,但服務仍然可能無法運行。
critical - 指定記錄錯誤(如果可能)。計算機嘗試重新啟動的最後一個已知的良好配置。如果最後一個已知的良好配置失敗,啟動失敗,啟動過程就會停止錯誤。
ignore - 指定該錯誤已記錄,啟動繼續。沒有通知,則給用戶使用超出在事件日誌中記錄的錯誤。
binpath= <BinaryPathName>:
指定服務二進制檔案的路徑。binPath= 沒有默認,並這個字串必須提供。
group= <LoadOrderGroup>:
這是一個成員組指定的名稱。組列表存儲在註冊表的HKLM\System\CurrentControlSet\Control\ServiceGroupOrder 子項中。默認值為空。
tag= {yes | no}:
指定是否CreateService函式調用方式獲得一個標籤識別。標籤僅用於根啟動或系統啟動驅動程式。
depend= <dependencies>:
指定的服務或組的名稱,這項服務開始前必須啟動。名之間用斜線(/)。
obj= {<AccountName> | <ObjectName>}:指定將運行的服務帳戶中的名稱,或指定的Windows驅動程式對象的名稱中,肇事司機將運行。
displayname= <DisplayName>:指定一個友好的服務名稱,可用於識別服務的用戶界面程式。
password= <Password>:指定一個密碼。這是必需的,如果使用LocalSystem以外的帳戶。
/?:在命令提示符下顯示幫助。

備註

對於每一個命令行選項,等號是選項名稱的一部分。
需要一個空格之間的一個選項,它的值(例如,鍵入=自己。如果省略空間的操作將失敗。

示例

以下示例顯示了如何使用sc創建命令:
sc \\myserver create NewService binpath= c:\windows\system32\NewServ.exe
sc create NewService binpath= c:\windows\system32\NewServ.exe type= share start= auto depend= "+TDI Netbios"

相關詞條

熱門詞條

聯絡我們