Jump to content

Can I set environment value for a service ?


xinglp
 Share

Recommended Posts


Yes but it might be slightly complex and your service might not accept it.

There are 3 ways to do it :

- The first two is create a new service with instsrv et srvany from the resource kit :

- make the new service launch a cmd which will set the variable and launch directly the executable launched by the original service

- or make a new service launch a cmd which will modify in the registry the environment variable and then launch the service sleep a little and remove the added reg entry

-The third way is to use a specific user for this service and set the variable for this specific user only. This is the easiest way if your service support it.

Link to comment
Share on other sites

> The first two is create a new service with instsrv et srvany from the resource kit :

> make the new service launch a cmd which will set the variable and launch directly the executable launched by the original service

I just put the service's exe path to "svc.cmd" , and create a service by

sc create XXX binPath= path\to\svc.cmd

but when I start it , met the error below

1053

The service did not respond to the start or control request in a timely fashion.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...