Search found 3 matches
- 21 Jun 2013 10:23
- Forum: DOS Batch Forum
- Topic: Batch code to compare numbers
- Replies: 6
- Views: 12592
Re: Batch code to compare numbers
Hi Squash please check the below code for better understanding of the problem. set i=1 set temp=5 ( taking count of the file in the folder) for /l %%G in (1,1,5) do ( if !i!==1 ( echo one GOTO FIRST ) else ( echo not one GOTO LAST ) :FIRST Doing operation specifically to first file :LAST Doing opera...
- 21 Jun 2013 09:27
- Forum: DOS Batch Forum
- Topic: Batch code to compare numbers
- Replies: 6
- Views: 12592
Re: Batch code to compare numbers
Thanks Squash, Below is the part of code: set i=1 for /l %%G in (1,1,5) do ( if %i%==1 ( echo one ) else ( echo not one ) set /a i=%i%+1 ) i can use %%G in place of "i" value which gives me incremented value. But i need to do some other operation in the middle of the loop so here i am usin...
- 21 Jun 2013 08:42
- Forum: DOS Batch Forum
- Topic: Batch code to compare numbers
- Replies: 6
- Views: 12592
Batch code to compare numbers
I need to compare two numbers in batch script. could any one provide the code?
example:
set i=1
if %i%=1 (
echo one
) else (
echo not one
)
i am using the above code in the for loop where "i" value will be incremented.
Thanks

example:
set i=1
if %i%=1 (
echo one
) else (
echo not one
)
i am using the above code in the for loop where "i" value will be incremented.
Thanks