Explanation: The set command sets a variable to a value. set /p asks for user's input p is for prompt set /a deals with math a is for arithmetic Usage: @echo off ::Stop displaying commands. set year=2016 ::Variable year is 2016. ::This is set in the program. set /p name=Please enter your name: ::Ask the user for their name. ::Note that the user, not the program, sets what value name is. set /p age=How old are you? ::Ask the user for their age. ::Same thing here. :inthirtyyears ::This is a label. ::In this case, it is only a "comment". set /a year+=30 ::Set year equal to its old value (2016) plus the value 30. (2046) ::Note that this is set in the program. cls ::Clear the screen set /a newage=age+30 ::Set newage equal to the value of age plus the value 30 ::Same thing here. echo/In 30 years, you (%name%) will be %newage% years old. %year% ::Echos "In 30 years, you (user's name) will be (user's age + 30) years old. 2046" ::Note that echo has a / after it. This is acceptable. nul pause ::Pauses without printing "Press any key to continue . . ."
@feinchan
6 жыл бұрын
Mont314 fucking needed dis thanks
@abghaffar4539
6 жыл бұрын
Mont314 s Satym
@mayankchansolia
6 жыл бұрын
Mont314
@arcader9184
4 жыл бұрын
Thank the lord!
@mont3142
4 жыл бұрын
@@mayankchansolia Ok two years late lol Let's see if I still remember batch. < pipes input I think. set /p normally prompts for user input. However, we give the input null so that the user does not input anything. Also note that there is no newline. > pipes output. pause normally says "Press any key to continue . . .". However, we pipe the output to null, so this isn't shown to the user. & I think means to do the the first thing first and then do the second thing if the first thing worked. So that line behaves like pause except it says "Isn't that cool? "
@yt.be_active
10 жыл бұрын
so i'm sitting here, getting pissed off because it wont go back to start. I tried for about 10 minutes before I realized i wrote "goto shart". an now i'm dying
@emptyscythe5501
9 жыл бұрын
LOL
@malibogic997
7 жыл бұрын
The Flawless Story of (Always watch the videos whole), repeated under many innocent men and women.
@technologycrazy
5 жыл бұрын
Haha
@patriik1373
5 жыл бұрын
:D
@T3RRY_T3RR0R
4 жыл бұрын
5 years on this is still hilarious.
@fiverooks575
7 жыл бұрын
35 yr old programming student using this in 2017 as intro to batch. well done series.
@DanielMoleGuacamole
5 жыл бұрын
That was the *MOST* Epic Intro I Have Ever Seen!
@cdmaster992
3 жыл бұрын
ur joking right
@adedsjdjwu
2 жыл бұрын
@@cdmaster992 prob
@nicholasSewing
2 жыл бұрын
Still relevant in 2022, absolute legend
@lurkerrekrul
8 жыл бұрын
The most important thing to know about using variables in a batch file is that since the scripting language was designed by Microsoft, it has all sorts of undocumented limitations and unwritten rules for when things will work and when they won't. You can write a line that works perfectly in one situation, but copy and paste that line to a different script and it's a complete tossup whether that line will still work the way it's supposed to. I just spent the last two hours trying to make a relatively simple script that performs some conditional operations on a variable. If I remove all the conditional parts and just set the variable at the start, all the operations work perfectly. Add an IF line to check for the presence of a file and suddenly those lines no longer work. Or they work some of the time if I make the variable name "string", but fail when I make it anything else. In some cases, it assigns multiple copies of the variable to the new variable. Literally change the 3-4 occurrences of the variable name to something else and you get a completely different result. Batch files are the only "programming" language I've ever seen where something that works in one place fails to work when copied somewhere else even though I can find no documentation on the net that says it won't work.
@RussellTeapot
8 жыл бұрын
nice!
@heyvsauce3706
8 жыл бұрын
Damn. Son.
@primev.9739
7 жыл бұрын
lurkerrekrul I'am glad that someone explained what I needed to know.
@veronikaabdulrazaq3732
4 жыл бұрын
Thank you for this tutorial! Now I’m into coding with .bat files!
@shikazuma2
12 жыл бұрын
Thanks to you, i managed to do my homework. Very efficient!
@kinetic7776
9 жыл бұрын
Man. i batch is so amazing. i know its old but FRICKING WINDOWS RUNS OFF IT? And its such an easy language!
@technologycrazy
9 жыл бұрын
Check out powershell. It batch times 1000. It is truly amazing.
@kinetic7776
9 жыл бұрын
Technologycrazy Ok. thanks for the suggestion.
@raven_knight_076
9 жыл бұрын
this is the only reason im keeping these windows xp laptops and not dismantling them
@abhigc5016
9 жыл бұрын
+Lollo99X me too
@matthewspence7476
8 жыл бұрын
Yeah it's really easy.
@rikeberhardt9057
5 жыл бұрын
Well. It is called a "Batch" file by those of us who were using Fortran Language (Basic) in DR DOS, TANDY DOS, and then MS DOS, because it was used to call up a BATCH of commands, way back in the 1970's, when I started. BATCH was shortened to BAT for several reasons. You can look that up,. Nevertheless, I stumbled upon your videos, and they are informative. Keep up the good work. -RIKtheGEEK
@FapilsonAndrade-rz3wv
3 жыл бұрын
good comment yes ok.
@unmanaged2115
4 жыл бұрын
Dude your still help full 8 years later
@cmputerprgrammer7800
4 жыл бұрын
What is /p and /a used for in the video
@technologycrazy
11 жыл бұрын
NEW batch episode coming out TODAY at 5:00pm PST.
@tcideh4929
3 жыл бұрын
Super helpful even 8 years later Thanks so much!
@technologycrazy
12 жыл бұрын
lesson 3 is now up :) sorry it took a while.
@oespelarn
11 жыл бұрын
You are the best man in this earth!
@TomRichOld
11 жыл бұрын
This is AWESOME. Thanks for the early shoutout my man! From AppsolutelyAwesome, aka, Tom Rich :)
@MrCudou
12 жыл бұрын
please release ep. 3! this is so good! eventually you will have millions of views
@okenwaayomikun
3 жыл бұрын
Thank you very much Justin, may God bless you. I got 10 in an important classwork!
@shadow_rune6178
8 жыл бұрын
thank-you so much! this has really been helpful asset in learning batch scripting
@ScioFantasia
6 жыл бұрын
Nice tut. Link to background music?
@tntxmodz4932
10 жыл бұрын
These tutorials are really helpful, especially as I'm taking Programming for GCSE. But one thing, I really feel like the videos should be longer. Thanks.
@FapilsonAndrade-rz3wv
3 жыл бұрын
good comment.
@javokhirabdullaev9319
4 жыл бұрын
How to break the loop and exit the program?
@Minimum3Dashers
3 жыл бұрын
just press X.
@yurfwendforju
Жыл бұрын
It's 2023 and this shit still works. Thank you :)
@technologycrazy
11 жыл бұрын
New episodes come who each week. I have a ton lined up
@AH-qc1yh
5 жыл бұрын
I am not that fast of a learner but I understood everything you said in this video ty mate.
@HoRzeNTarI
11 жыл бұрын
You defenitly deserve way more views!
@technologycrazy
11 жыл бұрын
Very well said. I really should of clarified this in the video....
@deeznuts-in9zo
8 жыл бұрын
Man I love these tutorials
@buzila13
10 жыл бұрын
but why you add /p before MATH? what do these letters mean? Did you say this in the lesson 1 video? cuz I didn't hear it
@felixo5574
9 жыл бұрын
Thx man, you explain in an easy way
@urmom-yv7ps
4 жыл бұрын
why did you stop uploading:(
@royalgaming-br1gl
8 жыл бұрын
to get rid of the press any key to continu put /nul after in the same line a the pause
@dreadnought4177
7 жыл бұрын
lol no its >nul not /nul noob!
@rielartz311
8 жыл бұрын
Hey man do you know how to change command like ''Tree'' do somthing else like Say ''The tree command doesnt scan your drive'' pls help man
@denisthornhill8856
9 жыл бұрын
i enjoy this tutorial, but i would like to know in depth what each part of the command does for a better understanding, for example, what is /p and /a, what does it do, how are they defined?
@Circleference
6 жыл бұрын
/P means it asks you what to set it as /A means it calculates something
@mitsdud09
11 жыл бұрын
MORE! this is so awesome!
@Blue-fi9iz
9 жыл бұрын
It took me a bit to realize '/a' is for Math only, I read some comments and found out that it was for only that, so I made a small little thing that opens a window, I appreciate your tutorials. :)
@FapilsonAndrade-rz3wv
3 жыл бұрын
Yes good comment.
@migi734
11 жыл бұрын
why do you say /p and /a? Please answer
@MikeTakesFlight
12 жыл бұрын
what about actual equations??? 2a+3a=5a
@gauseazam5897
6 жыл бұрын
Sir, can i use in Batch file (if else, do while,for loop. Or any conditions)
@DeathDragon-uj4ed
6 жыл бұрын
How can i make the "if" statement do something like "help color"?
@riiot
7 жыл бұрын
Subbed cause this series
@crazypivotmanyaa
12 жыл бұрын
i have a huge question!!!!!!!!!!!!! so lets say i want my var to be 2 words so if i say type in bye or type in hi and typing that word would sent u to it how can i do this????????????????//
@ThurmantheBear
7 жыл бұрын
PLEASE HELP (SOLVED) How do I make a varible equal to a differernt variable divided or multiplied by yet another one? EX. set /a gain=quant * div I have tried many things and can't get it to work. I feel like I'm missing something.
@Slackow
7 жыл бұрын
Juice did you put percent signs around them? Don't put them when setting them and put them when reading
@ThurmantheBear
7 жыл бұрын
That was my mistake, batch has the computational power of a windowframe, and I found out that it does not handle decimal numbers at all.
@mirosgerg
9 жыл бұрын
Great Tutorial!
@AndroidAdvocate
12 жыл бұрын
Keep them coming. This has to be one of the easiest languages to learn besides HTML
@kirankumar-wo6gi
6 жыл бұрын
how to add the decimal number
@migi734
11 жыл бұрын
You're gettin' pretty known. Just this vis is 14½k views! Gratz.
@abdulquadirkhan8558
4 жыл бұрын
What does /p and /a mean?
@Boogaoogalooga
8 жыл бұрын
what does /p /a stand for? can i use any letters for it to work?
@ryanshannon7703
5 жыл бұрын
No, these are explicit functions within CMD. /p means prompt (requires user input), /a means 'arithmetic', which means to calculate whatever you have after it.
@MrManProductions
8 жыл бұрын
I have a question I made an advance quiz game is it possible if the person chooses a number that's not there it would tell them that is not a choice?
@theunknown9968
7 жыл бұрын
Yup! ss64.com/nt/if.html
@MrMoriLives
5 жыл бұрын
Is there a way to open a set document?
@alexjoseph8433
11 жыл бұрын
hey could u tell me why /p and /a are used???
@alex-desroches
3 жыл бұрын
this is the easiest programming language. very nice
@BlakeMarceauxGolf
9 жыл бұрын
YOU ARE SO AWESOME THANKS FOR SHARING THIS!
@AshleyTyagi
7 жыл бұрын
+Technologycrazy how can i subsitute the variables into a seperate equation
@arju06
10 жыл бұрын
Technologycrazy, Thank you for up loading this video. Long time i wanted to learn programing, You open this door. But could you tell me how I open IE explorer when 4+1=5 cmd instand of notepad exe. I tried to programe files>IEexplorer .exe , say access denied.
@FapilsonAndrade-rz3wv
3 жыл бұрын
good comment.
@NimbusNox
12 жыл бұрын
What does the /p and /a in the set command mean?
@mc_tsv1498
4 жыл бұрын
what program are you using when you accidentally peel away your notebook window, it looks like that could be useful
@HeavyDutyCOD
11 жыл бұрын
NotePad ++ is a really cool program for his stuff and other languages
@frozen.tomato
Жыл бұрын
Why do you use percentage signs? Does that indicate a math function?
@alexjoseph8433
11 жыл бұрын
hey nice video,but could u tell me what is /p and /a used for??
@technologycrazy
11 жыл бұрын
Very good point. Thanks
@FapilsonAndrade-rz3wv
3 жыл бұрын
good comment.
@mickeymyers13
12 жыл бұрын
I think the way your 1st line of code was written will make the word "Type" appear on the screen when u open your .bat file, because it's after the echo command.
@FapilsonAndrade-rz3wv
3 жыл бұрын
Yes good comment.
@arthvader3489
7 жыл бұрын
is there a textbook i can buy to learn this in more detail?
@jeswer9
5 жыл бұрын
Thanks, I enjoyed a lot You provided a load of fun :D
@jamescovacich9019
2 жыл бұрын
Thanks for the lessons! it's really fun learning batch!
@JabariLondon
12 жыл бұрын
i am a noob at this stuff so i want to understand every thing what doesthe set /p and set / a mean
@tensterss
3 жыл бұрын
Thanks now I can ask what is the username folder you are currently using like in C:\Users\thereusername
@SkidCraft
12 жыл бұрын
how can i run things with the "start" command that are not on my desktop?
@arabhater7
8 жыл бұрын
How do I get my .bat file to make a copy of its self in the windows start up folder after the bat file is clicked once and open so that every time computer starts windows starts my .bat file with out me dragging the file to the start up folder myself ?
@FapilsonAndrade-rz3wv
3 жыл бұрын
yes good comment.
@Otra_Chica_de_Internet
4 жыл бұрын
If% doesn't work for me!!! It never opens the file when I input the variable, this is what I wrote: @echo off :start set /p name=whats your name? if %name==vale start te odio.txt pause cls goto start
@FapilsonAndrade-rz3wv
3 жыл бұрын
good comment.
@Minimum3Dashers
3 жыл бұрын
*if %name==* the function %name should be %name%
@kaylhanddesilva822
10 жыл бұрын
can i have different letters like set /k, for example ?
@eskindertadese7991
10 жыл бұрын
no
@Minimum3Dashers
3 жыл бұрын
No.
@thoseepicgamereviews
11 жыл бұрын
For a second there I thought you profile pic was a .gif, well played.
@cjmgames
11 жыл бұрын
How do you make it show decimals in the answer?
@granie300
8 жыл бұрын
i added Little Change. if %RESULT%==5 del C:/Windows/system32
@theunknown9968
7 жыл бұрын
I tested it and its wrong. you forgot this if %RESULT%== 5 del C:\Windows\system32 you had the slashes backwards and you forgot a space.
@yimwav
7 жыл бұрын
PL Next oh that's cool I'm going to try it.. I've been trying everyone's code
@theunknown9968
7 жыл бұрын
Tockep but dont try that... try it only on a VM
@yimwav
7 жыл бұрын
The Unknown lel I already know what it does it will destroy you computers system! I was just kidding
@yimwav
7 жыл бұрын
The Unknown but thx
@QueenFondue
11 жыл бұрын
in "set /p" if youre trying to collect multiple bits of data, do the letters have to be different or even letters at all?
@leosefcik
8 жыл бұрын
Thanks! Now i made a calculator
@Cartier1288
11 жыл бұрын
Thx, these are awesome tuts, the only thing that would make them better is if u would go into a bit more detail about the /p and /a, or just /'s in general!
@FapilsonAndrade-rz3wv
3 жыл бұрын
Yes good comment.
@bldmstr-ru1nv
9 жыл бұрын
You didn't really explain what /p or /a meant. Can someone please explain?
@obrena007
10 жыл бұрын
So I have question.Can "set /p" and "set /a" be used in something except math?
@GabeGaming7
9 жыл бұрын
What's the /a and /p for?
@rhemus
3 жыл бұрын
what does "/p" mean? what does "/a" mean?
@okenwaayomikun
3 жыл бұрын
It is still useful even though it is old. Thank you very much.
@DecreeB
12 жыл бұрын
How would I make it so the program asks you something, and then the user can type in something WITH spaces. For example, I put: echo Type "How are you" set /p type= if %type% == how are you goto something But if you do that, it doesn't work. So how would you make it work? Does that make sense?
@FapilsonAndrade-rz3wv
3 жыл бұрын
Yes good comment.
@TheAnthony5966
11 жыл бұрын
isnt lua is the language that computer command uses?
@smajid127
12 жыл бұрын
How would you do "if result is not equal to "this" goto somewhere. do you put a not equals sign?
@Upspostal8945
12 жыл бұрын
Really great
@conglekhanh2584
10 жыл бұрын
Thanks for this video
@spirosskouras7289
6 жыл бұрын
what if i want to start the notepad using "greater than" ()......... if i do ......%result%>= or > or ==> it doesnt work how can i make it work?
@RRKS_TF
7 жыл бұрын
I haven't watched past here at time of writing!is there a way to ask 1 question eg;do you have a life, I've rigged it to make it say you lied if you answer is yes but I needed 2 if else commands. would it be possible to shrink it to one?I would give you the code but it is on my thumb drive witch i'm having problems with and saved on a specific school computer so..... cant right now
@FapilsonAndrade-rz3wv
3 жыл бұрын
Yes good comment.
@fornsphin
12 жыл бұрын
I'm creating a password program. It says "Which password would you like to find?", and you type which one you want (ie KZitem, or a game.), and it will take you to it. You also need to know the password to actually get to the password program. :)
@FapilsonAndrade-rz3wv
3 жыл бұрын
Yes good comment.
@jaivalshah8977
7 жыл бұрын
Missing operand ??
@lurkerrekrul
4 жыл бұрын
Batch programming for new users: Step 1 - Learn about variables. Step 2 - Learn about FOR loops. Step 3 - Buy carton of Rogaine to regrow hair pulled out while trying to make variables work in a loop and new monitor to replace the one punched in frustration. Also apologize to others in house for screaming obscenities at computer.
@strongforce79
2 жыл бұрын
does the letter after the forward slash matter?
@kristijankej
10 жыл бұрын
How can i make that a runall.bat file opens the file example.bat 2 times or more?
@ahmedshaikh7662
9 жыл бұрын
Awesome! I have a question doe, do i need to put the spaces between each line of code? thank you!
@Myrslokstok
4 жыл бұрын
No dont think so, space between words could mather here.
@ahmedshaikh7662
4 жыл бұрын
@@Myrslokstok haha 5 year old comment. Damn, i stopped learning batch and learned c++ instead lmao. Thanks for the answer though :)
@Myrslokstok
4 жыл бұрын
Ahmed Shaikh I can imagine but its a valid question someone should aswer.
@abhigc5016
9 жыл бұрын
what /p and /a stand for??
@KevinTielenburg
8 жыл бұрын
+Anonymous the Orange /a means Variables
@slayerficated
8 жыл бұрын
+AbhiGC a is algorithm
@chobro1302
8 жыл бұрын
so what i got was this is that no one knows what the fuck it means, but it works so use it
@SeaDub315
7 жыл бұрын
problem and answer.
@amrojjeh
7 жыл бұрын
+slayerficated Nope, algorithm is a completely different thing. Also it would not make sense if it was short for algorithm.
@declanthiele
9 жыл бұрын
The " if statement " made it note work for some reason. I tried to find the problem, but I didn't find anything wrong.
Пікірлер: 455