MSFN Forum: Can I set environment value for a service ? - MSFN Forum

Jump to content


Unattended CD/DVD Guide Homepage · MSFN Forum Rules

If you have questions about customizing Windows XP that are nLite-specific, please post them in the nLite forum, not here. If you have questions regarding the unattended installation of Windows XP, please post them in the Unattended Windows 2000/XP/2003 section.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Can I set environment value for a service ? environment value service Rate Topic: -----

#1 User is offline   xinglp 

  • Newbie
  • Group: Members
  • Posts: 13
  • Joined: 04-September 09

Posted 03 April 2011 - 11:19 AM

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

This post has been edited by xinglp: 03 April 2011 - 11:20 AM



#2 User is offline   allen2 

  • Not really Newbie
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,737
  • Joined: 13-January 06

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

#3 User is offline   xinglp 

  • Newbie
  • Group: Members
  • Posts: 13
  • Joined: 04-September 09

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.

#4 User is offline   allen2 

  • Not really Newbie
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,737
  • Joined: 13-January 06

Posted 04 April 2011 - 12:47 PM

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

#5 User is offline   xinglp 

  • Newbie
  • Group: Members
  • Posts: 13
  • Joined: 04-September 09

Posted 05 April 2011 - 03:08 AM

View Postallen2, 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
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy