• Announcements

    • xper

      MSFN Sponsorship and AdBlockers!   07/10/2016

      Dear members, MSFN is made available via subscriptions, donations and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, become a site sponsor and ads will be disabled automatically and by subscribing you get other sponsor benefits.
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.