I wrote a service program with WinAPI functions with c++ And I want to create that by wmic.exe in service manager with bellow command :
service create name="test" where path = "C:\Users\msi\Desktop\SampleService.exe"
But it give me the error :
Invalid format.
Hint:= = [, ].
How can i create a service with wmic.exe tool?
Answer
I believe the answer is that wmic cannot create a new system service.
I have run an elevated Command Prompt and executed the commandwmic service create /?:Full, to receive this output:
The list of properties has included every possible argument that a system
service would require, all marked as "N/A", meaning "Not Applicable".
I have also searched on google for "wmic service create", and found a paltry
four answers, but none of them was related to creating a service.
I think that you will need to resort to another tool than wmic.
For example, PowerShell documentation includes the applet
New-Service.
WMI itself includes such a method in
Create method of the Win32_Service class,
but you will need to call it via other method than wmic.

No comments:
Post a Comment