Welcome to MSFN

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.


Sign in to follow this  
Followers 0
xinglp

Can I set environment value for a service ?

5 posts in this topic

Can I set environment value for a service before it start, without affect others .

Edited by xinglp
0

Share this post


Link to post
Share on other sites

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.

0

Share this post


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

0

Share this post


Link to post
Share on other sites

You need srvany.exe et instsrv from the resource kit.

It has nonthing to do with the srvany, instsrv or sc.

The service cmd need " @echo off "

0

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.