Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 



Sign in to follow this  
xinglp

Can I set environment value for a service ?

Recommended Posts


allen2    1

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.

Share this post


Link to post
Share on other sites
xinglp    0

> 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.

Share this post


Link to post
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

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×