Microsoft KB Archive/197178

= Passing Environment Variables to Applications Started by SRVANY =

Article ID: 197178

Article Last Modified on 10/31/2006

-

APPLIES TO


 * MSPRESS Microsoft Windows NT Resource Kit

-



This article was previously published under Q197178



IMPORTANT: This article contains information about editing the registry. Before you edit the registry, make sure you understand how to restore it if a problem occurs. For information on how to do this, view the "Restoring the Registry" online Help topic in Regedit.exe or the "Restoring a Registry Key" online Help topic in Regedt32.exe.



SUMMARY
Some applications you want to launch using SRVANY from the Windows NT Resource Kit may require specific environment variables that you may not want to set as, or set differently than system variables.

You can launch a batch file from SRVANY, do the modifications to the environment there, and then start the application. But there is a drawback: SRVANY will not terminate the application when you stop the service. Instead, it will terminate Cmd.exe. This makes it hard to administrate this service, especially remotely.



MORE INFORMATION
There is a new version of Srvany.exe that supports setting the environment for the application. After you have stopped all SRVANY-based services and copied the new version into the location used by the services, follow these steps:

WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

For information about how to edit the registry, view the "Changing Keys And Values" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe. Note that you should back up the registry before you edit it. If you are running Windows NT, you should also update your Emergency Repair Disk (ERD).

  Start the Registry Editor (Regedt32.exe) and go to the following subkey:

     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services \ \Parameters

NOTE: The above registry key is one path; it has been wrapped for readability.  Click Add Value from the Edit menu. In the Value Name box, type AppEnvironment, select REG_MULTI_SZ as the

Data Type, and click OK.

  In the Multi-String Editor, enter environment variables using the syntax =.

For example:

     app_setting1=27 temp=c:\tempfiles

Do not forget to add a new line after the last line, or the value will be ignored. </li> Click OK in the dialog box.</li></ol>

The next time you start the service it will receive the environment the same way as you specified it.

NOTE: Only the settings in this registry entry will be passed to the service, so make sure to include all core entries like PATH, TEMP, OS, and so on, in the registry entry.

You can find the new file at the following locations:

ftp://ftp.microsoft.com/bussys/winnt/winnt-public/reskit/nt40

Intel:

i386/srvany_x86.exe

Alpha:

alpha/srvany_axp.com

Keywords: kbinfo KB197178

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.