Discussion Locked

NET USE command in login scripts

0 helpful
10 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am trying to creat a login script but I'm having probelms, when I test the test.bat file it runs in a loop ?

test.bat has the following:
echo Hello %USERNAME% <- ok
net use h: /del <- problem
net use h: \\home\%USERNAME%$ <- problem

10 replies

by joncr

I would concatenate the path as a single variable.

set mypathvar=\\home\%USERNAME%$
echo Your home path is %mypathvar%
net use h: /d
net use h: %mypathvar%

This makes it more simple to debug.

by stalymi

Try this login script it works!

@Echo OFF
@Echo Mapping CAO-NTS1 Drives......

REM (PJC) 2.05.01 Version 6
REM ADMISTRATION SHARES
REM ADDED PIPE TO REMOVE SCREEN ERRORS

net use H: /DELETE >C:\LOG.TXT
@Echo Checking Connection for H...net use I: /DELETE >C:\log.txt
@Echo Checking Connection for I...
net use R: /DELETE >C:\LOG.TXT
@Echo Checking Connection for R...
net use T: /DELETE >C:\LOG.TXT
@Echo Checking Connection for T...
net use V: /DELETE >C:\LOG.TXT
@Echo Checking Connection for V...
net use X: /DELETE >C:\LOG.TXT
@Echo Checking Connection for X...
net use Y: /DELETE >C:\LOG.TXT
@Echo Checking Connection for Y...

NET use H: \\cao-nts1\%HomeDir% >c:\LOG.TXT
@Echo Mapped H: (Home)....
net use I:\\cao-nts1\CriticalApps >c:\log.txt
@echo Mapped I: (Critical Apps)....
net use R: \\cao-nts1\StandardApps >c:\log.txt
@echo Mapped R: (Standrard Apps)....
net use T: \\CAO-NTS1\NetTech >c:\LOG.TXT
@Echo Mapped T: (NetTech)....
net use V: \\CAO-NTS1\WPData >c:\LOG.TXT
@Echo Mapped V: (CAO-Letter Head)....
net use X: \\cao-nts1\D$ >c:\LOG.TXT
@Echo Mapped X: (D drive on CAO-NTS1)....
net use Y: \\cao-nts1\E$ >c:\LOG.TXT
@Echo Mapped Y: (E Drive on CAO-NTS1)....

by mebudman

net use h: /d /y (they can be spell out fully or just the abbr.)
net use H: /home (/home switch can only be run on win9x computers)

for nt boxes have the user defined in the profile button in user manager with the Home Directory section ConnectH: \\server\%username%$ this will be mapped when they logon their h drive will point to their user directory

hope this helps.

This discussion is closed to new replies.