![]() |
|
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. - Reverence - 08-04-2011 (08-03-2011, 08:19 AM)chipp Wrote: yes, but where is it defined? is it in the do? and so that's mean that %%a is not the same a we've declared before right? It's defined in the IN in the FOR command. RE: Batch. The Ultimate Tutorial. - chipp - 08-04-2011 so what's this line means: Code: echo texttexttext>%%aRE: Batch. The Ultimate Tutorial. - Reverence - 08-05-2011 (08-04-2011, 03:42 PM)chipp Wrote: so what's this line means: It writes "texttexttext" to the file. The ">" means to write to a file. And the file being written to is the one being defined by "%%a" in the IN statement in the FOR command. RE: Batch. The Ultimate Tutorial. - chipp - 08-05-2011 oh, so it's like "for each" in C#, am i right? RE: Batch. The Ultimate Tutorial. - Reverence - 08-05-2011 (08-05-2011, 05:23 AM)chipp Wrote: oh, so it's like "for each" in C#, am i right? Something like that, yes. But Batch isn't close to being as powerful as C#. RE: Batch. The Ultimate Tutorial. - chipp - 08-20-2011 btw, how to increase a variable's value? i tried this but it doesn't work... Code: @echo off
set a=1
: go
echo this will printed on your screen for %a% times
a=a+1
goto go
pauseRE: Batch. The Ultimate Tutorial. - Reverence - 08-20-2011 (08-20-2011, 06:00 AM)chipp Wrote: btw, how to increase a variable's value? i tried this but it doesn't work... Get rid of the space after the line label. RE: Batch. The Ultimate Tutorial. - chipp - 08-21-2011 i guess it's just the same, i tried this code and not working too... Code: @echo off
set a=1
set b=1
:go
echo this will printed on your screen for %a% times
set a=%a%+%b%
goto go
pauseRE: Batch. The Ultimate Tutorial. - Zabra - 08-21-2011 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 questionIs there some bug in the code ... because it gives "-unexpected end of file" and closes instantly whatever the value of "input" maybe... (08-21-2011, 08:22 AM)chipp Wrote: i guess it's just the same, i tried this code and not working too... try this chipp : Code: @echo off
set a=1
set b=1
:go
echo this will printed on your screen for %a% times
set a=%a%+%b%
pause
goto gobut still it does not giv the value .. it extends as 1+1+1+1.... O.OO.O RE: Batch. The Ultimate Tutorial. - chipp - 08-22-2011 btw, i tried to do something like this: Code: @echo off
diskpart
select volume 4
remove letter m
list volumebut it doesn't work, can anybody tell me how? it's the same with my effort to runas command Code: runas /user:user_one program.exe
passwordthe result is nothing... -_-! HELP...! @zabra: it is treated as string so i guess the problem with the initialation, maybe it should convert to int when it is initialized. |