This post has been edited by xinglp: 03 April 2011 - 11:20 AM
Page 1 of 1
Can I set environment value for a service ? environment value service
#1
Posted 03 April 2011 - 11:19 AM
Can I set environment value for a service before it start, without affect others .
#2
Posted 03 April 2011 - 01:56 PM
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 :
-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.
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
- 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.
#3
Posted 04 April 2011 - 02:42 AM
> 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.
> 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.
#4
Posted 04 April 2011 - 12:47 PM
You need srvany.exe et instsrv from the resource kit.
#5
Posted 05 April 2011 - 03:08 AM
allen2, on 04 April 2011 - 12:47 PM, said:
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 "
Share this topic:
Page 1 of 1



Help
Back to top









