Skip navigation

JSI Tip 0973. How do I set specific environment variables for SRVANY launched applications?

If you require specific/different settings for environment variables in an application that you launch with SRVANY from the Resource Kit, you would think that you could have SRVANY start a batch file, in which you make the modifications and then launch your application. While this does work, it makes it very difficult to administrate the application, since stopping the service mearly stops CMD.EXE, not the application.

Newer versions of SRVANY support a new REG_MULTI_SZ value named AppEnvironment which you add at:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<service name>\Parameters

On each line of this Multi_String variable, you add an entry for every environment variable you want the application to see. The syntax is:

PATH=c:\AppFolder;c:\winNT;C:\WinNT\System32;.... App_Switch=123
. . .

Don't forget to add a new line as the last entry.

With the AppEnvironment variable present, no standard environment variables will be usable for this service, unless they are specified in the Multi_String editor.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.