1.

Solve : Batch file string / text processing query?

Answer»

Can ANYONE tell me how to extract some information contained in a text FILE called dircount.txt and place it in an environment variable ? I want to be able to extract the number 5 from the text file contents as shown below. I want to do this using DOS batch files.

The file contents of dircount.txt is as follows;

---------- DIRLIST.TXT: 5


Which version of DOS or Windows are you using.
Win NT,2K,Xp has for /F
The other versions don´t don´t have the /f switch. (I guess,
CORRECT me if I am wrong).

uliSorry for omitting that information.

I am using Windows 98 - DOS

cheers
This filters the third column and brings it in %var%.
Works with NT4. If it isn´t working in Win98 I can´t help.
uli



@Echo off

set file=test.txt

For /f "tokens=1-3 delims= " %%a in ('type %file%') do set var=%%c

set file=
set var=
:eof



Discussion

No Comment Found