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?