Skip navigation

JSI Tip 1786. Another way to set %UserName%, %ComputerName%, and %LogonServer% for W9x.

In tip 0120, the %UserName%, %ComputerName%, and %LogonServer% variables could be retrieved by Kixtart and set into W9x by WINSET.

You can use PUTINENV.EXE to retrieve these environment variables and WINSET.EXE, from the W9x CD-ROM, to set them into the Windows environment.

If you type <PATH>\PUTINENV.EXE /? at a CMD prompt, you receive:

PUTINENV 2.13 by MJ Winkler, Apr  7 1993, 13:32:00.
PUTINENV is a batch file enhancer that puts or modifies variables in
DOS' Environment.  You may then access these variables from a batch
file.  See your DOS manual for details.

Syntax is:  PUTINENV command \[argument(s)\] \[/U | /L | /P\] \[/M\]
    Where:  command = the PUTINENV command (see list below).
            argument(s) = the argument(s), if any, to the PUTINENV
            /U = Make returned environment strings uppercase.
            /L = Make returned environment strings lowercase.
            /P = Preserve case (default).

            /M = Edit the "master environment". The Master Environment
                 is the one owned by the first command processor.
            /O:appname = Edit another application's environment.

ErrorLevel will be set >= 1 if there is an error.

Cmd Arguments               Description and variable(s) created.
--- ----------------------- --------------------------------------------------
 ?                          Displays this help information.
 A  network_name or '*'     Determine the "burned in address" of the adapter
                            that the network_name is defined on.
                              STRING=12 hex-digit address
 C                          Determines the current machine/computer name.
                              STRING=computer name
 D  device                  Determines the server name and share name assigned
                            to a redirected device.
                              SERVER=server name (no '\\')
                              SHARE=share name (no '\')
 E  \[+ | -\]directory;       Edit the PATH variable. Use '+' to insert a
                            directory, '-' to remove one. Separate directories
                            with a ';'. You may also list multiple directories
                            at one time (i.e +C:\123;-C:\WP51;).
 F  filespec                Splits a filespec into its component parts.
                              DRIVE=drive letter (no ':')
                              DIR=directory(s) (no ending '\')
                              FNAME=file name
                              EXT=file extension (no '.')
 L                          Supplies following info on LAN Manager:
                              ROOT=location of LANMAN directory
                              COMPUTERNAME=computer name
                              USERNAME=user name
                              LANGROUP=lan group or default_domain
                              LOGONSERVER=logon server
                              MAJOR=major version number
                              MINOR=minor version number
 N                          Determines the current network/NetBIOS/User name.
                              STRING=user name
 P  prompt length \[default\] Prompts for input of specified length and
                            returns the default if nothing is entered.
                              STRING=string entered or default
 Q  prompt length \[default\] Just like P but echos *'s instead of
                            the actual characters--great for
 R                          Report status of the environment.
 S  string start length     Extracts a substring.
                              STRING=requested portion of string
 T  12 or 24                Time (12 or 24 hour format) and Date. If 12 hour
                            format is selected, 'a' or 'p' will be appended
                            to TIME.
 V                          DOS version.
                              MAJOR=major version number
                              MINOR=minor version number
 Z   variable=string        Mimick the DOS SET command with the exception that
                            the variable-name case is preserved.
Thus, you can use the following, or similar, snipit in your logon script:

if "%OS%"=="Windows_NT" goto winnt
if exist %windir%\putinenv.exe goto nth
copy %0\..\putinenv.exe %windir%\
%windir%\putinenv.exe L
%LogonServer%\NetLogon\Winset USERNAME=%USERNAME%
%LogonServer%\NetLogon\Winset LOGONSERVER=%LOGONSERVER%

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.