Batch/Cmd Programming: Lesson 1 (Basics)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello technology crazier and today we're going to be working with bat files and learning a little bit about bat programming so it's very very basic it's basically I'm just going to be covering what is bat files what is CMD all that stuff and some basic commands and how to make bat files and stuff like that just for the basics and then later on we'll move on to different videos for more advanced video so I'm hoping to make this a series because these videos are really really easy to make but basically what it is a bat file now you don't need any software to make bat files but we're going to be covering that in a second basically it's CMD so on Windows 7 you can just type in CMD here and open it up now this is what we call command prompt a long time ago before I was born there was something called ms-dos now this was an operating system it was by Microsoft and the whole operating system was a command prompt you had to type in every single thing you needed to do just that's just because they didn't have a lot of computers faced and a lot of RAM and all that stuff if everything was basically this but then when they moved up to GUI now everyone just enjoys dragging their files around and I do too but if we go back to CMD we have full control of the whole system so some of the stuff you can do if your administrator on your computer you do net user get a list of all your users net user and then you just type in the user you want and space star now this is where you can actually change their password from CMD because CMD has full access or the whole computer stuff you can't necessarily do in Windows you can do in CMD so we're gonna be harnessing that power with bat files basically when you make a bat file whatever you type in that bat file it will open up CMD and run it so any commands in CMD will work in bat files basically CMD is a portal now it's that's like what I like to think of it as a window now in Windows 30 system 32 is you can see that's where it's running from there's a whole bunch of different commands like the shutdown command which is very very fun to use if look it up but basically it's it looks like it's running in CMD but it's actually a shutdown dot exe and so it's not actually in the CMD program and what seem D does when you type it in it'll actually search in this folder for the shutdown dot exe so it's a member that CMV is not a program by itself it's more like a window of what you can do and you can also download and make your own commands beside the shutdown and I'll be showing you that right now so if we right click on anywhere on the windows and go to new and go to text document and we can open this up and save it as a bat file I know how to do this you just go to save as type and go to all files because you don't want a txt because that's a like notepad file and now we just have to type dot bat after our file and there you've made a bat file it's empty but it is a bat file so now if we refresh delete the text file and we have our bat file right here where you can right-click and go to edit and edit it so now we're just going to be going over some very basic commands that you'll be very very useful until the next video where I go a little bit more in depth and move on move on until I we get like extreme programming and stuff like that but basically the very first one is very very important one it's @echo off now just show you this we're going to do echo high which is basically going to say hi when you want to say something you can just do echo hi now if we run it right now you're going to notice it closes right aways and you can't see anything that's kind of useless so we need to add a command called pause so now if we won it will pause it won't close right aways and I'll say press any key to continuing that old close basically we can see it says echo hide and then says hi but we don't want it to say echo hi and all this stuff necessarily to do this we'd get rid of it basically we can go at echo off and this will it won't show any of the commands it won't show this command it will only show what this command actually does it like it won't show echo off you'll just say hi instead of echo I so just as hi there and then our pause command the next room we're going to be talked about is the clear function or command basically it's very useful for clearing the screen now I'm just going to do two pauses in here and put the clear thing so right now it's going to do echo off turn it off say hello pause and once after I continue the pause it'll clear the screen and then pause again save that and so it says hi press again and it cleared the screen and paused again that's a very very useful command if you're getting into a lot of lines of code next one is very interesting one it's called the go to command and it's fairly easy to understand it'll bring you to any line of code in your in your program so let's say we had the same program right here and we did echo Justin let's say we didn't actually want it to go to Justin but we wanted to go to start with like the code will run here go to the next line go to the next line well let's say we want to skip Justin go over there we can go go to end and later on we can do : and now what we'll do is go to and it'll look for end and when you do a call it in front of slang you'll actually skip out of that code so if you type in end in CMD just the end it's not going to recognize the code but when we do like : end it won't actually run as a command it's like kind of invisible so end is invisible until you use the go to command you'll find the end and go there and let's pause again so it should skip echo Justin and it did hello and then skip to echo Justin went to the pause so that's just a very very basic understanding of what bat can do some of the cool things I'm going to put in the description I've made a master program here I'm not going to release it all because it does contain some of my passwords and stuff like yeah but some of the really cool ones you want to check out is I have a CMD command where you can actually unlock CMD at school because any school or any smart school would block CMD so you can't search and open it up we'll say access tonight but this will allow you to open up your bat file that you made basically I'm just going to just copy and paste the code then give you in the description into this and you'll get this really cool program which is basically CMD actually central to CMD but it's a bat file and it will not be blocked unless your school blocks bat file so that that's a little bit fun trick and there's also the shutdown command and let me just explain this to you um before I end this video if I type shut down just like that and get lots of writing now up here we have the usage and this is syntax of it now what a syntax will in English it's the order of letters or numbers or words in a sentence or something like that with programming it's the same thing it will show you how to use the shutdown command so to activate it you have to write shutdown and then these are all the different variables that you can use and including the computer name and the time and stuff like that so with bat files we'll take the syntax so we'll take this whole thing and we'll do it all automatically so later on that this is it unplugged going way over your head right now but I'll just show you what you can do and we'll move on the next video later on so if I write down shutdown they'll say well compress any continue and you can type in the computer IP and the numbers in seconds and you want to send the message and it will run and also ask you if you want to abort now to all that coding from the syntax like all these different variables like the time is somewhere here this is the time right here and it's tuck it all into one piece of code that was really really easy to do so that's what you can do with the go to command and also variables and stuff like that but we'll cover that in later video so I'm just kind of rambling off just to get you a basic understanding of what CMD is and if you want to check out what you can do just go into the internet and search cool CMV commands and if you have if you wonder what a command is oops like if you wonder what what does the shutdown command do or how do you use it you can do slash question mark after the command and it will give you how to use it now it already said that before but let's say we did like ipconfig which will tell you your IP address you colon slash and it'll tell you how to use IP config so you can actually say slash all after or slash renew or stuff like that it'll basically tell you how to use it and give you all the information just to help you guys out but you can also go and check out Google so I hope you guys check out more stuff about back we're going to be moving more on in the later videos and I hope this isn't too long but I wanted to make it very very simple for you guys to understand what bat files are and I hope you guys have tons of fun with it and I guess that's all from technology crazy good bye okay so the Pippi program winner this week is science hide oh now he makes really cool chemical videos and actually quite interested channel a pretty watch take almost all his videos just because he's a kid but he seems like he has a great understanding of chemicals and chemical reactions and he's always really really cool like explosions or how to do this and that make nitrogen something rather like big baking soda and vinegar explosions so if you want to go and check out his channel I like to do is go and click on the click Me button on your screen right now if you want to join the Pikmin program and get a free shadow all you to do is go into my latest video and say pick me and you can say it as many times as you want and I might pick you from my next video so I guess that's all I hope you have a wonderful new year and goodbye
Info
Channel: Technologycrazy
Views: 879,044
Rating: undefined out of 5
Keywords: bat, cmd, batch, programming, programing, how, to, tutorial, windows, ms-dos, Computer, How-to, Batch File, Basic, shutdown, script, Batch, program, Batch File (File Format), create, text, files, extract, from, xp, Windows XP (Operating System), hack, others, Tutorial
Id: kboexp3QiUg
Channel Id: undefined
Length: 9min 30sec (570 seconds)
Published: Sun Jan 01 2012
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.