1

Windows XP Embeddedでサービスを作成する方法(Sc.exeはインストールされていません)?

4

1 に答える 1

0

あなたはVBScriptを使ってみることができます、私はここからこのコードを見つけました、OPはそれが完全に機能すると言っているので、おそらく試す価値があります。

' Connect to WMI. 
set objServices = GetObjecT("winmgmts:root\cimv2") 

' Obtain the definition of the Win32_Service class. 
Set objService = objServices.Get("Win32_Service") 

' Obtain an InParameters object specific to the Win32_Service.Create method. 
Set objInParam = objService.Methods_("Create").inParameters.SpawnInstance_() 

' Add the input parameters. 
objInParam.Properties_.item("Name") = "GPServer" '< - Service Name 
objInParam.Properties_.item("DisplayName") = "GPServer" '< - Display Name, what you see in the Services control panel 
objInParam.Properties_.item("PathName") = "c:\Server\srvany.exe" '< - Path and Command Line of the executable 
objInParam.Properties_.item("ServiceType") = 16 
objInParam.Properties_.item("ErrorControl") = 0 
objInParam.Properties_.item("StartMode") = "Manual" 
objInParam.Properties_.item("DesktopInteract") = True
'objInParam.Properties_.item("StartName") = ".\Administrator" '< - If null, will run as Local System 
'objInParam.Properties_.item("StartPassword") = "YourPassword" '< - Only populate if the SatrtName param is populated 

'More parameters and return statuses are listed in MSDN: "Create Method of the Win32_Service Class" 


' Execute the method and obtain the return status. 
' The OutParameters object in objOutParams is created by the provider. 
Set objOutParams = objService.ExecMethod_("Create", objInParam) 
wscript.echo objOutParams.ReturnValue
于 2013-01-22T13:43:16.257 に答える