As an system administrator or uber home geek you are probably well versed in the creation of batch files to accomplish certain tasks. However, you may find the need to create a batch file to accomplish a task such as mapping a network drive that you want to not be editable for the end user and also be able to solicit the user for input to map their particular drive. Using DOS batch script techniques and a handy little utility, we want to show how this can be accomplished.
The utility is called Bat to EXE Converter and can be found here. It is really great, small, free utility that allows you to point it to a standard batch file and create an .exe file from that batch file. There are a lot of really cool options that can be configured with this utility as well. Some of the options include:
- Making the program visible or invisible
- Encrypting the program
- Including other files
- Embedding version information
- Adding an icon file
Creating a batch file
We want to create a batch file that solicits a username from the end user as well as a password. After getting this information the batch will simply take that information and feed it into the mapped network path to successfully map the user’s network drive which matches their username.
net use * /d /y
set /p USER=Enter your username here (any other instructions you want to display to the user):
net use x: \fileserver.yourdomain.com\%username%$ /user:DOMAIN\%username% %pass%
Creating the EXE
At this point all that has to be done is point the Bat to EXE Converter utility to the batchfile that we created above and then tell it where to put the .exe file that it creates. You can add an icon, encryption, or other options to the program as you see fit or need in your particular environment.