Download EnvRep.

I quote the author:

"This is a command line utility that allows you to use environment variables inside script files, registry files, batch files, macros, or any text file. It does a search and replace using environment variables or special built-in variables (called SmarTokens) as the replacement values. SmarToken variables available include PC serial number, username, computer name, MAC address, special system folder paths, IP Address, current directory and many more. Ever wanted to automatically fill in a users ID or computer name in a .reg file, without manually editing the file?"

When you open a CMD prompt and type EnvRep /?, the program displays:

Environment Replacement Utility v2.2 Beta 5 (SmarToken Engine v1.7g)
Copyright 2000-02 Douglas Good, Outside The Box Software.
Homepage: www.otbsw.com
Freeware version, may not be sold.

This utility replaces occurrences of variables in text files.
Variables (known as SmarTokens) are in form #VARIABLE# (or %VARIABLE%
for environment variables.)

An input file containing SmarTokens is read, and an output file is
written where the SmarTokens are replaced with their respective values.

Example: an input file containing this line:  COPY *.* %TEMP%
might be written to the output file as:       COPY *.* C:\WINDOWS\TEMP

Use EnvRep /L to list available SmarTokens and their values.
Use EnvRep /I to write all SmarTokens out to an INI file named SMARTOKN.INI

Usage: <b>EnvRep.exe (\[source file\] \[output file\]) | (/L) | (/I) | (/?)</b>
When I typed EnvRep /L the following SmarTokens were displayed:
EnvRep v2.2 Beta 5 Copyright 2000-02 Douglas Good, Outside The Box Software.
Using SmarToken Engine v1.7g
#AMPM#             = PM
#APPDATA#          = C:\Documents and Settings\Jerry\Application Data
#CACHE#            = D:\Temporary Internet Files
#CAPSLOCK#         = OFF
#CDROM1#           = E:
#CDROM2#           =
#CDROM3#           =
#CLIPBOARD#        = www.jsiinc.com
#COMMONDESKTOP#    = C:\Documents and Settings\All Users\Desktop
#COMMONFAVORITES#  = C:\Documents and Settings\All Users\Favorites
#COMMONFILES#      = C:\Program Files\Common Files
#COMMONSTARTMENU#  = C:\Documents and Settings\All Users\Start Menu
#COMMONSTARTUP#    = C:\Documents and Settings\All Users\Start Menu\Programs\Startup
#COMPUTERNAME#     = JSI005
#COOKIES#          = C:\Documents and Settings\Jerry\Cookies
#CURRENTDIR#       = C:#CURRENTDRIVE#     = C:
#DATE#             = 07/25/2002
#DATECODE#         = 20020725
#DAY#              = 25
#DAYOFWEEK#        = THURSDAY
#DEFPRINTER#       = \\JSI001\HP Business Inkjet 2250 PCL 5C
#DESKTOP#          = C:\Documents and Settings\Jerry\Desktop
#DOMAIN#           = JSI005
#EXECDIR#          = C:\UTIL#EXECDRIVE#        = C:
#FAVORITES#        = C:\Documents and Settings\Jerry\Favorites
#FONTS#            = C:\WINNT\Fonts
#HDD1#             = C:
#HDD2#             = D:
#HDD3#             =
#HDD4#             =
#HDD5#             =
#HDD6#             =
#HDD7#             =
#HDD8#             =
#HISTORY#          = C:\Documents and Settings\Jerry\Local Settings\History
#HOUR#             = 1
#HOUR24#           = 13
#IPADDRESS#        = 216.144.1.25
#MACADDRESS1#      = 00-30-F0-21-30-17
#MANUFACTURER#     = Phoenix Technologies LTD
#MINUTE#           = 34
#MODEL#            = Inspiron 7500
#MONTH#            = 07
#MONTHNAME#        = JULY
#NETDRV1#          =
#NETDRV10#         =
#NETDRV2#          =
#NETDRV3#          =
#NETDRV4#          =
#NETDRV5#          =
#NETDRV6#          =
#NETDRV7#          =
#NETDRV8#          =
#NETDRV9#          =
#NUMLOCK#          = OFF
#PERSONAL#         = C:\Documents and Settings\Jerry\My Documents
#PRINTER0#         = \\JSI001\HP 2250 TRAY 1
#PRINTER1#         = \\JSI001\HP Business Inkjet 2250 PCL 5C
#PRINTER2#         = \\JSI007\HP OfficeJet R80xi
#PRINTER3#         = HP Business Inkjet 2250 PS
#PRINTER4#         = Generic / Text Only
#PRINTER5#         = Fax
#PRINTER6#         = ActiveTouch Document Loader
#PRINTER7#         =
#PROGRAMFILES#     = C:\Program Files
#PROGRAMS#         = C:\Documents and Settings\Jerry\Start Menu\Programs
#RANDOM1#          = 696189
#RANDOM2#          = 904462
#RANDOM3#          = 834842
#RECENT#           = C:\Documents and Settings\Jerry\Recent
#REGCOMPANY#       = JSI, Inc.
#REGOWNER#         = Jerold Schulman
#SCROLLLOCK#       = OFF
#SECOND#           = 46
#SENDTO#           = C:\Documents and Settings\Jerry\SendTo
#SERIALNUM#        = 123456789
#STARTMENU#        = C:\Documents and Settings\Jerry\Start Menu
#STARTUP#          = C:\Documents and Settings\Jerry\Start Menu\Programs\Startup
#TIME#             = 13:34:46
#TIME24#           = 13:34:46
#TIMECODE#         = 133446700
#TIMESTAMP#        = 07/25/2002 13:34:46
#USERNAME#         = Jerry
#VIDDEPTH#         = 24 bits
#VIDEORES#         = 1280x1024
#VIDFREQ#          = 90Hz
#WINDIR#           = C:\WINNT
#WINSYSDIR#        = C:\WINNT\System32
#WINTEMPDIR#       = D:\TEMP
#YEAR#             = 2002