|
Answer» I apologize in advance if its somewhere on here, but I've only found similar issues, but none that meet my need.
I created a basic batchfile to map network drives for users on laptops. They're all running winXP pro sp2. I need the batch to prompt for a DEPARTMENT ID #.
Here is the batch file currently:
Code: [Select]@echo off net use U: \\lgfileserver2\888user\%username% net use S: \\lgfileserver2\888share net use Z: \\lgfileserver2\leapfrogshare if errorlevel 1 goto error CLS
echo Your network drives have been mapped! Pause 10 goto end
:error echo If you experience any issues accessing the drives or you are MISSING any drives, please contact the Helpdesk at 1(888) XXX - XXXX and leave this message on the screen. pause goto end
:end I'm rather novice, so I may have an unneeded code somewhere, but I just need the prompts. As you can see, this person will be mapping to department ID 888 (both USER and share). Is there a way that I can prompt the user to input that INFORMATION?
Thank you in advance.Code: [Select]@echo off set /p dept=Enter Dept ID: net use U: \\lgfileserver2\%dept%user\%username% net use S: \\lgfileserver2\%dept%share net use Z: \\lgfileserver2\leapfrogshare if errorlevel 1 goto error CLS
echo Your network drives have been mapped! Pause goto end
:error echo If you experience any issues accessing the drives or you are missing any drives, please contact the Helpdesk at 1(888) XXX - XXXX and leave this message on the screen. pause goto end
:end
Note: The pause statement takes no parameters and does not act as a timer. The IF ERRORLEVEL statement only refers to the last NET USE statement. Not sure if NET USE issues ERRORLEVELS but if it does you'd need an IF statement for each of them.
Good LUCK. 8-)That worked perfectly. Thank you very much! I knew I had some extra/not completely correct codes in there.
And errorcodes seem to work for any type of error on net use.
|