How to Create a Batch (.bat) File in Windows

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi guys and welcome to another video today i'm going to be showing you how to create your first batch file or dot bat file as it's also abbreviated as quickly and easily today we will be creating a batch file to run multiple programs from a single batch file we are going to be adding three programs to the batch file the first one being putty the second being vlc media player and the third being the notepad now to make a batch file or a bat file you're going to need a text editor that text editor can be something simple such as notepad for example i'm on windows so today we're going to be using notepad to create our dot bat file i'm just going to double click notepad to open it once you've got your notepad open we can begin creating our.bat file now the first line of our batch file we're going to include this simple piece of text here we're going to start off with an at symbol echo space off this echo off command that we have just included is a great little command because it basically prevents the command prompt from displaying all our commands i would therefore describe the echo off command as a housekeeping command it keeps everything looking nice and clean i will show you towards the end of the video how the echo off command compares to the echo on command now echo is usually on by default hence why we have to include the echo off command let's move on to the next step now so what you're going to do you're going to go to the second line now so you're going to hit enter and now we're going to start including the commands to run each of our programs so the first program we're going to tell this batch file to run is going to be putty so what you're going to do is you're going to type start space and then the program name so in our case it's putty this command will basically open up putty now to open up vlc as well as putty you're going to hit enter again you're going to type start space and then vlc and this will now open up putty and vlc to open up putty vlc and notepad you're going to hit space again you're going to type start space and notepad now this will open up putty vlc and notepad all at once and of course echo is going to be off remember i'm only including three programs you can include as many programs as you want and they can be any programs that you want them to be remember to ensure each command is on its own line great so i'm happy with the current file now how do we save this text document as a bat file all we need to do is go file and then save we have to give this file a file name so i'm going to call it start putty vlc and notepad once you're happy with the file name we got to add one crucial piece of text you're going to have to add to the file name dot b-a-t or dot bat and this will convert your text document into a batch file once you've added the dot bat extension to the file name you're ready to go you can simply now hit save and just like that you'll have created your first batch file as you can see there it is on the bottom left hand side corner i'm just going to pull it up here and now you can simply close out of your text editor fantastic so to run this batch file all you need to do is double click on it so that's exactly what i'm going to do here double left click and it will run and there you go you can see that vlc has opened our notepad has also opened here and putty has also opened just like that and that pretty much concludes how to create a batch file guys but before we end i just want to show you how echo on looks compared with echo off so let me just close out the three programs here real quick and i have two screenshots on my desktop here so i'm just going to show you how it looks like with echo on as you can see the screenshot basically shows the commands in the command prompt when the batch file that we've just created runs this is what is seen for the split second and let me just x out of this just to show you how echo off looks and as you can see none of the commands are displayed in the command prompt which is very neat and looks very nice when you have multiple commands in a single batch file all right guys on that note that pretty much concludes the video i hope you enjoyed if you did be sure to give this video a like comment down below if it helped and remember to subscribe to support the channel i'll see you on the next one guys [Music] you
Info
Channel: Websplaining
Views: 126,973
Rating: undefined out of 5
Keywords: How to Create a Batch (.bat) File in Windows, batch, .bat, batch file, .bat file extension, file extension, .bat file, how to run a batch file in wi, how to run a .bat file windows 10, windows 10, windows, batch scripting, scripting, batch script, batch file extension, batch file extension changer, How to Create your first .bat file to open multiple programmes, script file, Microsoft Windows, plain text file, DOS, OS/2, run .bat file, cmd, command prompt, open multiple programmes
Id: sODXtX7jdcI
Channel Id: undefined
Length: 5min 1sec (301 seconds)
Published: Wed Jul 29 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.