Login Scripts to Change a User to Home Directory
Retired KB Content Disclaimer
On the ServerBecause a LAN Manager login script cannot contain replaceable parameters,set up your login script like the file below:
NETLOGON.BAT ------------ echo net use s: \\servername\public >c:\local.bat echo net use v: \\servername\apps >>c:\local.bat echo net use r: /home >>c:\local.batNotice that the NET USE commands are redirected into a file on yourlocal hard drive and called LOCAL.BAT. Also notice the first NET USE hasonly one redirect symbol(>). This is necessary to recreate the LOCAL.BATfile; all succeeding commands are appended to the end of the file byusing the double redirect (>>).
On Each WorkstationCreate a batch file similar to the batch file below:
LOGON.BAT --------- net logon %1 call c:\local.bat cd r:\%1 r:Execute the LOGON.BAT file with a parameter of your username--"logonusername"--where username becomes the %1 variable.
The flow of the batch file is:
- Assume a username of maryjo
- Assume a directory named maryjo exists off of the root of your share on the server.
- User maryjo enters the command logon maryjo.
- The LOGON.BAT file runs with "maryjo" as the %1 variable.
- You are logged on as maryjo, and the script file then executes.
- The login script redirects all commands to the C:\LOCAL.BAT file.
- The login script ends, and the LOCAL.BAT file is called.
- All commands redirected to LOCAL.BAT by means of the login script are executed in the LOCAL.BAT file.
- The LOCAL.BAT file ends, and the LOGON.BAT continues to execute.
- The command "cd r:\%1" is executed, which causes the directory to be changed to R:\MARYJO.
- The command "r:" is executed, and you then are in directory R:\MARYJO>.
Article ID: 98706 - Last Review: 10/31/2006 19:20:40 - Revision: 1.1