Windows

Create an EXE from Batch File Map Drives

Learn how to Create an EXE from Batch File Map Drives

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

bat2exe

 

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.

@echo off

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.

Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.