for /f and findstr help please
Posted: 13 Sep 2011 12:53
Hi, me again ^^
this is the text in textfile.txt:
Now, what i want it to do is:
Green: variable
Blue: directory / file
Red: Step number
Pink: Stuff i want to be pink
Purple: Command
#1: Check for a line in a file that contains "version#"
#2: Assign that line to a variable (lets call it LineVar1)
#3: Use 'for /f' to split LineVar1 (that is why i added the #'s)
#4: Then take the 2nd part ('2.8') and assign that to LineVar2.
#5: Split it into 2 (in this case part 1 would be '2' and part 2 would be '8'.
#6: Assign thoose two parts into two different variables('Verp1' and 'Verp2')
#7: Do the same process with a different file (UFile.txt)
I can most likely do this part (#8 and #9) myself, but you might want to know the rest
#8: Check if 'Verp1' in 'textfile.txt' is greater than 'Verp1' in 'Ufile.txt'
#9: If #8 is false then check if 'Verp2' in 'textfile.txt' is greater than 'Verp2' in 'Ufile.txt'
EDIT:
Nevermind about the splitting 2.8 into two parts, figured i could do: if 2.8 gtr 2.9 lol
this is the text in textfile.txt:
Code: Select all
@echo off
cls
rem version#2.8#
((((lots of code that will be used later for a certain use))))
Now, what i want it to do is:
Green: variable
Blue: directory / file
Red: Step number
Pink: Stuff i want to be pink
Purple: Command
#1: Check for a line in a file that contains "version#"
#2: Assign that line to a variable (lets call it LineVar1)
#3: Use 'for /f' to split LineVar1 (that is why i added the #'s)
#4: Then take the 2nd part ('2.8') and assign that to LineVar2.
#5: Split it into 2 (in this case part 1 would be '2' and part 2 would be '8'.
#6: Assign thoose two parts into two different variables('Verp1' and 'Verp2')
#7: Do the same process with a different file (UFile.txt)
I can most likely do this part (#8 and #9) myself, but you might want to know the rest
#8: Check if 'Verp1' in 'textfile.txt' is greater than 'Verp1' in 'Ufile.txt'
#9: If #8 is false then check if 'Verp2' in 'textfile.txt' is greater than 'Verp2' in 'Ufile.txt'
EDIT:
Nevermind about the splitting 2.8 into two parts, figured i could do: if 2.8 gtr 2.9 lol