The first answer is correct but here is a little additional info. I usually have a login script that removes the drives and printers about to be mapped first like:
net use x: /d (this line deletes the x drive)
net use lpt2: /d (this line deletes the printer)
Then I create the mappings like:
net use x: \\server\apps (apps is a shared directory on the server)
net use lpt2: \\server\laserptr (laserptr is a shared printer on the server)
From the above x: drive is now the same as the apps share on the server and lpt2: has been mapped to the laserptr printer. The printer mapping is only necessary when printing from the older DOS programs. You can also keep the lines from echoing on the screen by adding > null to the end of the line like:
net use x: /d > nul
You can name your batch file with a .bat or .cmd extension and put it in the winnt\system32\repl\import\scripts directory. Make sure that the script resides on every Domain Controller and Backup Domain controller or the scripts won't always run because they are being logged by a backup domain controller instead of the primary. Good Luck.
I hope this helps