New
#10
If you want to obtain OS Edition, Type [x64/x86], Version, Build using a batch file then you could use this one -
Code:@echo off prompt $g :: Windows Edition Set UseExpresssion=Reg Query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ProductName" for /F "tokens=*" %%X IN ('%UseExpresssion%') do Set OSEdition=%%X Set OSEdition=%OSEdition:*REG_SZ =% echo %OSEdition% :: Windows Type If Defined ProgramFiles(x86) (Set OSType=x64) Else (Set OSType=x86) echo %OSType% :: Windows Version Set UseExpresssion=Reg Query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "ReleaseId" for /F "tokens=*" %%X IN ('%UseExpresssion%') do Set OSVersion=%%X Set OSVersion=%OSVersion:*REG_SZ =% echo %OSVersion% :: Windows Build - this includes the full build number such as Build 17134.376 Set UseExpresssion=Ver for /F "tokens=*" %%X IN ('%UseExpresssion%') do Set OSBuild=%%X Set OSBuild=%OSBuild:*10.0.=% Set OSBuild=%OSBuild:~0,-1% echo %OSBuild% :EndGetSystemProperties :: this consolidated output now shows, for example, Windows 10 Home x64 Version 1803 Build 17134.376 echo %OSEdition% %OSType% Version %OSVersion% Build %OSBuild% Pause at EndGetSystemProperties during testing
I have tested this on Ver 1709 & Ver 1803 [x64 and x86]. It has also been tested on Ver 1809.
In practice, I call this from other batch files & I omit / remark out the lines @echo off and Pause at End…
If I merely want to display the various parameters rather than use them elsewhere, I use a shortcut to the batch file that has this as its Target property
- This will remain open onscreen despite having that final Pause line omitted / remarked out.Code:%windir%\system32\cmd.exe /k "C:\Tools\ReportOSVersion.bat"
I call my batch file ReportOSVersion.bat and I save it along with all my other batch, vbs, PS & similar files within C:\Tools for which I have curtailed non-Admin user permissions to:- Read & execute, List folder contents, Read. Doing so mimics the protection Windows applies to the Program files folders.
Denis
Last edited by Try3; 14 Nov 2018 at 01:30.