I hope there is someone who can help solve this because my Dos scripting is pretty basic and I have not been able to create or find a solution so far despite trying for some hours.
I want to extract the Windows version from the registry which can be done using the following instruction, however it includes a lot of extra text which is not wanted
reg.exe query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName
This gives the following text
ProductName REG_SZ Windows 7 Ultimate
What I want is to extract the windows version after REG_SZ, trimming any spaces so that just the Windows version is returned or available in a variable. Therefore what will extract just the Windows version, be it Windows XP, Vista or Windows 7?