Problem solve Get help with specific problems with your technologies, process and projects.

Use environment variables in multiple contexts

Use free utility EnvRep 2.2 to sidestep hard-coded references to the system directory and other environment variable limitations.

Most administrators should be familiar with environment variables, which let you refer to areas such as the system directory without having to hard-code it. For instance, the environment variable %SystemRoot% refers to whatever the current system directory is -- usually C:\Windows, but by using the environment variable you can refer to it no matter where it actually resides. Unfortunately, environment variables are limited in their flexibility, only refer to a small range of system objects, and they can't be used in many contexts.

EnvRep 2.2, from Outside the Box, is a freeware utility designed to help overcome some of the limitations of environment variables. When supplied with a source file, EnvRep 2.2 replaces specially designated variables in the source file with real-time data that can then be piped to a new file. The resulting file can be run as a batch file or used in a log operation or as part of a report. Or, you can put it to a number of other uses.

Many of the variables supported by EnvRep are exclusive to the program and aren't supported as environment variables in Windows by default. For instance, the variable #APPDATA# is replaced with the path to the currently logged-in user's Application Data folder. #CLIPBOARD# is replaced by any text data currently on the clipboard and #DESKTOP# returns the path to the current user's Desktop. Input files can be ASCII or UTF-8, but clipboard text data in non-ASCII format is generally not recognized.

Along with the program, you get the full list of some forty or more custom environment variables. Running envrep /l from the command line gives you a list all the variables available. Existing system environment variables can also be used, whether defined by the system or by the user beforehand.


Serdar Yegulalp is editor of the Windows Power Users Newsletter. Check it out for the latest advice and musings on the world of Windows network administrators -- and please share your thoughts as well!

More information from

Dig Deeper on Domain Name System (DNS)

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.