Creating Batch File in WinXP

Quick question. I'm new to creating batchfiles. To start off with, this is
what I have so far:

cd C:\Program Files\Test\
del config.xml
echo 222222 >> test.txt

Here is where my question comes into play at. The number listed above
(222222) is my PCID # which is found by opening up a command prompt and
executing the command dir and you get the following output:

Volume in drive C is Local Disk
Volume Serial Number is 2222-2222

What I would like to know is if there is a way I can extract the number
listed above and have it put into the file test.txt. I have to do this on
several PC's so the numbers will all be different so I can't just manually
tell it to echo the # to the file like I'm doing above. I want the batch
file to execute the dir command and extract the Volume Serial Number into a
file. Does anyone know of a way to do this?

Relevant Pages

  • Re: Build Problem
    ... Well it looks like your command processor executable is missing or being ... blocked from executing. ... > @echo off ...
  • windows batch file help
    ... I am creating a batch file to extract the Volume Serial ... I start by running the following command from CMD.exe ... How can I extract or echo ONLY the 5555-5555 to a TXT file from the command? ...
  • Memory usage in UNIX pipe
    ... cat test.txt | xargs -n1 echo ... executing the above command? ...
  • Re: How to output a number
    ... michi wrote: ... given on the command line into decimal. ... and extract the part you need. ... @echo off ...
  • Re: Persisting env vars in cmd windows
    ... more about batch files as you go on, ... echo The time is %time::=.% ... But the piece de resistance was the "start" command, ... echo:: ERROR ERROR ERROR ERROR ...