|Thats a good idea (to repost it).|
By the way, I got the results I was looking for, but a different way. My way required a whole lot more junk to write than is needed, but at least for now, it will do.
Read this, and don't laugh too hard :) It's quite lengthy, but it does achieve the same result (which is to populate these variables with the data from the output file)
I documented this pretty well, so you will see clearly what each crazy line is doing. hehehe
wmic csproduct list full > c:\prep\baddata.txt
wmic csproduct list full > c:\prep\cs.txt
REM Get the "Name", "Vendor" and "Version" fields into variables
find /n "Name" c:\prep\cs.txt > name.txt
find /n "Vendor" c:\prep\cs.txt > vendor.txt
find /n "Version" c:\prep\cs.txt > version.txt
REM Populate variables with the hardware specifics
for /f "skip=1 tokens=*" %%a in ('type c:\prep\name.txt 2^>NUL') do set name=%%a
for /f "skip=1 tokens=*" %%a in ('type c:\prep\vendor.txt 2^>NUL') do set vendor=%%a
for /f "skip=1 tokens=*" %%a in ('type c:\prep\version.txt 2^>NUL') do set version=%%a
REM Remove ALL spaces from variables
set name=%name: =%
set vendor=%vendor: =%
set version=%version: =%
REM Remove unneeded characters from the variables
echo 'name' = %name%
echo 'vendor' = %vendor%
echo 'version' = %version%
Pretty crazy huh? :) This one I wrote so that it has to run from c:\prep but obviously that can be changed. I am simply going to change it so that it works from x:\ since I will need this to run from a WinPE disk.
You see, what I need this thing to do is decide which model computer PE has booted from, because I am building a hardware independent WinXP ghost image for my company. the idea is that I build a WinXP system that dual boots to PE. So when a tech images a machine and boots it, it would boot PE, which will then run this script, which will let it make a decision as to what hardware it's on. (The only variable I really need is 'version' because I will simply have a list of the hardware the image will support. The batch file will simply compare it's "version' variable against a list of known hardware types, and once it finds a match, it will then copy the correct windows drivers to a folder on the C: drive. It will then run a command to delete WinPE from the partition, and issue a reboot. The system will reboot, which will launch XP and run sysprep. Sysprep will now run, and use the drivers that WinPE had copied into the correct place, and the system will now load the drivers which are correct for this particular model.