|Thanks for the help guys, sorry it took so long for me to get back to you all.|
Try as I might, I was unable to understand the hieroglyphics above :). Unfortunately for myself, you guys are so far past me I might as well be rubbing two sticks together for fire. Anyway I ended up going back to scratch and came up with the below script. Now I'm sure it's inefficient as hell, but with what I know it's the best I could come up with, and as a bonus it does seem to work. I wasn't just blatantly disregarding your help I just am not advanced enough in batch files to understand what's going on.
I was wondering if any of you could point out problems you see with it and how it could be done better (as I'm sure you all can).
Again thanks for the help, this is by far the best place I've found to get this sort of information.
Here's the code:
:: Cleaning up before we get started
del /q /f "%temp%\produkey-dump.txt"
del /q /f "%temp%\linenumbers.txt"
del /q /f "%temp%\prodname.txt"
del /q /f "%temp%\productkey.txt"
:: DUMPING OUTPUT OF PRODUKEY.EXE (BY NIRSOFT) TO A TEXT FILE
"ProduKey.exe" /stext "%temp%\produkey-dump.txt"
:: ADDING NUMBERS TO EACH LINE
find /i /n " " "%temp%\produkey-dump.txt" > "%temp%\linenumbers.txt"
:: FINDING THE WINDOWS XP LINE NUMBER
findstr /i /c:"Windows XP" "%temp%\linenumbers.txt" > "%temp%\prodname.txt"
:: SETTING A VAR TO BE THE LINE SINGLED OUT ABOVE
set /p linefind=<"%temp%\prodname.txt"
:: SETTING THE VAR TO BE JUST THE NUMBER OF THE LINE SINGLED OUT ABOVE
:: ADDING +2 TO THE VAR SINGLED OUT ABOVE TO GET THE LINE OF THE PRODUCT KEY
:: AND ADDING BRACKETS AROUND THE SUM SO IT'S MORE UNIQUE.
set /a productkey=%linefind%+2
:: FINDING THE PRODUCT KEY LINE AND SENDING IT TO A TEXT FILE
findstr /i /c:"%productkey%" "%temp%\linenumbers.txt" > "%temp%\productkey.txt"
:: SETTING VAR TO BE PRODUCT KEY LINE SINGLED OUT ABOVE
set /p productkey=<"%temp%\productkey.txt"
:: REMOVING UNWANTED TEXT FROM THE VAR
echo %computername% %xpproductkey% >> \\server\share\coa.csv