![]() |
|
Batch. The Ultimate Tutorial. - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: Batch. The Ultimate Tutorial. (/Thread-Batch-The-Ultimate-Tutorial) |
RE: Batch. The Ultimate Tutorial. - chipp - 08-22-2011 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... RE: Batch. The Ultimate Tutorial. - hackerexecute_mybb_import6869 - 10-23-2011 Very nice tut. I wouldn't say copy and paste though. I would practice typing the codes by heart/memory to analyze them better. RE: Batch. The Ultimate Tutorial. - Diabolic666 - 11-21-2011 Great tutorial, really usefull
RE: Batch. The Ultimate Tutorial. - ArkPhaze - 11-27-2011 Quote:[spoiler=4. Conditional Statements] 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 questionYou use "=" instead of "==" on these lines: Code: if '%input%' = '2' goto correct
if not '%input%' = '2' goto falseAnd 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!
pauseShould have been: Code: :correct
cls
echo Good job!
pause
goto:questionAnd 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
exitPlease correct the errors. RE: Batch. The Ultimate Tutorial. - junaidnazir123 - 02-26-2012 Great Sharing ! Keep it up RE: Batch. The Ultimate Tutorial. - Kaiser Dash - 04-30-2012 Nice, I love it. I already knew batch, but this was a nice refresher. RE: Batch. The Ultimate Tutorial. - Mr Naj - 04-30-2012 A well detailed tutorial. I'm fully qualified in Batch and It's my strongest language. This definitely covers all basiscs. RE: Batch. The Ultimate Tutorial. - NgativeZero - 10-05-2012 Wow, this helped out a lot, thanks man, I look forward to more threads on the subject. RE: Batch. The Ultimate Tutorial. - Mazech - 12-05-2012 ok..nice one...try to swallow the tut..hehe RE: Batch. The Ultimate Tutorial. - Heartless - 01-05-2013 I have a lots of knowledge thanks bro ..... |