1.

Solve : DOS Batch File 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


This is OS dependent. The easiest WAY is to parse the line by reading it and defining the parsing template with the for /f instruction.

If your OS does not support the /f switch you may be SOL.

Hope this helps. Hmm THANKS I was wondering about that command. I'm using Windows 98 - DOS  It does seem to support the command, but UNFORTUNATELY not the /f parameter

:/  

cheers
check out what it has though, sometimes you will find that under different versions there is different parts to it that accomplish the same thing, such as instead of /f it MIGHT be something else... (annoying but TRUE)



Discussion

No Comment Found