Specifying the Home Directory in a Logon Script or Batch File

Windows NT provides three environment parameters you can use in a logon script or other batch file to specify the location of the home directory, or in Program Manager to specify the working directory of an application. Logon scripts are described later in this chapter. If a home directory has not been defined for the user, the default values are used as shown in the following table.

Table 3.1 Environment Parameters for Logon Scripts and Batch Files

Parameter name

Definition

Default value

%homedrive%

Drive where the home directory is located

Drive where the Windows NT system files are installed

%homepath%

Path name of the home directory

\USERS\DEFAULT

%homeshare%

UNC name of the shared directory containing the home directory, or a local or redirected drive letter

No default value


If the \USERS\DEFAULT directory does not exist on the drive specified by the %homedrive% parameter, the value of the %homepath% parameter is set by default to the \USERS directory on that drive. If the \USERS directory does not exist, the %homepath% parameter is set to the root directory specified by the %homedrive% parameter.

When the user opens a Command Prompt window, the default directory is the equivalent of %homedrive%%homepath%. If a user's home directory is specified on a remote computer and that computer is not available, the default directory of the Command Prompt on a Windows NT Workstation computer is the user's home directory on the local workstation.

You might also want to specify the working directory of each application as %homedrive%%homepath%. That way, all File Open and Save As dialog boxes default to the user's home directory.