setting variable and conditional statement

September 6, 2011 at 03:47:19
Specs: Windows XP, pentium 4
Hi ..I have a batch scripting and I'm try to check the following statement ..
Please let me explain using "word" not with command because my english is not very well
I have about 1000 records in a file that may have different values for examples (red,yellow,blue,black,white ....)
I'd like a script ..like this ..

read the record and put it in a variable (es color)
check the color
if the value of the color is red ..then color = fire
if the value of color is blue then color = sky
if the value of color is white then color = snow
Please help me
Regards


See More: setting variable and conditional statement

Report •

#1
September 6, 2011 at 14:03:46
you need a for loop. Something like this.


for /F "tokens=*" %%A IN (file.txt)
if %%A=red echo fire
if %%A=blue echo sky
if %%A=white echo snow


Report •
Related Solutions


Ask Question