Discover USERNAME variable on 9x systems for login.

If you want to map a drive to the users home directory and the home folder is shared as the login name, but the client is pre-Windows NT (i.e. 98, 95) and you want all users on your network to run the same login script, then here's an easy script to use to discover to users login name and use it to replace a variable for the mapped drive.

if %OS%!==Windows_NT! goto NEXT
if exist user.exe cd..
net config|find /I "USER">us!r.bat
echo set USERNAME=%%2>user.bat
echo if not %%3!==! set USERNAME=%%2 %%3>>user.bat
echo if not %%4!==! set USERNAME=%%2 %%3 %%4>>user.bat
call us!r.bat
del us?r.bat >nul
:NEXT
net use h: /delete > nul:
net use h: \\%servername%\%username%
 
*********************************************************
(Leave all coding above :NEXT as is)
(replace %servername% with the actual server's UNC name but leave the %username% as written)

*********************************************************

Did this info help you? If so, email me and let me know about it or ask a question.