Login Register


Batch. The Ultimate Tutorial. filter_list
Author
Message
RE: Batch. The Ultimate Tutorial. #21
Quote:Remember, one ">" is to create the file, and two ">" is to append to the file. To save time, you may want to assign the file that you are creating or appending to to a variable.

i just notice it, so i want to clarify, ">>" is to append, and if the file is not exist yet, it will create the file...
[Image: ap8g35.jpg]

Reply

RE: Batch. The Ultimate Tutorial. #22
Very nice tut. I wouldn't say copy and paste though. I would practice typing the codes by heart/memory to analyze them better.
[Image: 20t2nn7.jpg]
︻┳═一
HackerExecute
Pwned | Twitter

Reply

RE: Batch. The Ultimate Tutorial. #23
Great tutorial, really usefull Smile
Everything you knew of, redefined.

Reply

RE: Batch. The Ultimate Tutorial. #24
Quote:[spoiler=4. Conditional Statements]

Conditional statements can be very complicated to a newbie in programming languages. But luckily, in Batch, conditional statements are only sand compared to the full beaches of C, C++, Python, and other various Programming Languages.

Try this code!

Code:
@echo off :question echo What's 1+1? set /p input= if '%input%' = '2' goto correct if not '%input%' = '2' goto false :correct cls echo Good job! pause :false echo You are one dumbass. echo Try again echo. goto question

Let's analyze the code!

if: Tells the interpreter to do a command if certain conditions are met. The main conditional statement. What's the variable being used? "Input"! That's right! The ' are optional but highly recommended.

if not: Tells the interpreter to do a command if certain conditions are NOT met.

echo.: Just makes a blank line.

cls: Clears the screen.

[/spoiler]

That is wrong. For a stickied thread there should be no errors in the code lol, but there is unfortunately.

Code:
@echo off :question echo What's 1+1? set /p input= if '%input%' = '2' goto correct if not '%input%' = '2' goto false :correct cls echo Good job! pause :false echo You are one dumbass. echo Try again echo. goto question

You use "=" instead of "==" on these lines:
Code:
if '%input%' = '2' goto correct if not '%input%' = '2' goto false

And why not demonstrate the else part?

Another error I see in this is that, even if you get it correct, there's no goto to define where to go after :correct, meaning it goes to :false right after displaying the correct message, displaying a false echo after saying "Good job!" lol

This:
Code:
:correct cls echo Good job! pause

Should have been:
Code:
:correct cls echo Good job! pause goto:question

And if you wanted a better demonstration of an if logic statement I would have written that like this:
Code:
@echo off echo What is 1 + 1? set /p input= if "%input%"=="2" ( echo Correct! ) else ( echo Wrong... ) pause exit

Please correct the errors.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: Batch. The Ultimate Tutorial. #25
Great Sharing ! Keep it up

Reply

RE: Batch. The Ultimate Tutorial. #26
Nice, I love it. I already knew batch, but this was a nice refresher.
[Image: SPIDERMANLUCK.png]

Reply

RE: Batch. The Ultimate Tutorial. #27
A well detailed tutorial. I'm fully qualified in Batch and It's my strongest language. This definitely covers all basiscs.
-Diabolic|Need Help? Just ask.
[Image: U2voP.png]
Doing my absolute best for the community.

Reply

RE: Batch. The Ultimate Tutorial. #28
Wow, this helped out a lot, thanks man, I look forward to more threads on the subject.
Challenge the elite, prepare for defeat. (-0)

Reply

RE: Batch. The Ultimate Tutorial. #29
ok..nice one...try to swallow the tut..hehe

Reply

RE: Batch. The Ultimate Tutorial. #30
I have a lots of knowledge thanks bro .....

Reply







Users browsing this thread: