Link to home
Start Free TrialLog in
Avatar of rafiq01
rafiq01

asked on

How to add 'Parameters' key, it's value name and value value in the registry using sc.exe

Hello,
In order to start an application with a service when the computer starts I am have created a service using the following code:

sc create MyTestService binPath= c:\windows\system32\srvany.exe type= own type= interact start= auto

This works perfectly to create the service with start type automatic and interact with desktop. However, I need to add a key called 'Parameters' in the registry created by the above command under:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyTestService]

And, then I want to add a value like:

"Application"="c:\\Program Files\\3D\\MyTestService"

After creating the service with the sc.exe I can manually create this 'Parameter' key, add value and it wroks fine but I do not want to do this manually. I want to do it through sc.exe.

Your quick response is greatly appreciated.

sc create MyTestService binPath= c:\windows\system32\srvany.exe type= own type= interact start= auto

Open in new window

Avatar of rafiq01
rafiq01

ASKER

Correction:
I want to create a key called 'Parameters' under:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyTestService]

And, then I want to add a value like:

"Application"="c:\\Program Files\\3D\\MyTestApp.exe"
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rafiq01

ASKER

Excellent!

Works perfectly.

Thanks so much the life saver