It is currently March 28th, 2024, 1:24 pm

WINVER

General topics related to Rainmeter.
Questor
Posts: 1
Joined: December 25th, 2018, 2:08 pm

WINVER

Post by Questor »

I want the full WINVER to show in my "Rainmeter-box". Somthing like this:
WINVER = Windows 10 version 1803 (OS-build 17134.471) 64-bit

How do I mange it?

Regards Mr.Q
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: WINVER

Post by CyberTheWorm »

That program has nothing to do with rainmeter so if you want to change it you might want to learn how program in Windows
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: WINVER

Post by balala »

Questor wrote: December 25th, 2018, 2:20 pm I want the full WINVER to show in my "Rainmeter-box". Somthing like this:
WINVER = Windows 10 version 1803 (OS-build 17134.471) 64-bit

How do I mange it?
You can do this, using the RunCommand plugin. For example:

Code: Select all

[Rainmeter]
Update=-1
DynamicWindowSize=1
AccurateText=1

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
State=Hide
OutputType=ANSI
OutputFile=#CURRENTPATH#CPUName.txt
FinishAction=[!DisableMouseAction MeterRun "LeftMouseUpAction"][!SetOption MeterRun Text "%1"][!UpdateMeter "MeterRun"][!Redraw]

[MeterRun]
Meter=STRING
MeasureName=MeasureRun
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Get Windows version
LeftMouseUpAction=[!CommandMeasure MeasureRun "Run"]
User avatar
Yincognito
Rainmeter Sage
Posts: 7020
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WINVER

Post by Yincognito »

Questor wrote: December 25th, 2018, 2:20 pm I want the full WINVER to show in my "Rainmeter-box". Somthing like this:
WINVER = Windows 10 version 1803 (OS-build 17134.471) 64-bit

How do I mange it?

Regards Mr.Q
A better (and less resource intensive) way would be to just query the keys in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion from the Windows registry (run regedit.exe and paste the above path in the editbox at the top to see those keys). There's even a specific example in Rainmeter's manual about it, using the Registry measure. :D

Relevant keys that could be passed to the RegValue option of the Registry measure include ProductName, ReleaseId, EditionID, CurrentBuildNumber, CurrentBuild, BuildLabEx, and even CSDVersion if you want to get the service pack number of a Windows OS prior to Windows 10.

The only thing this is not getting is the 471 minor build version, but then, balala's answer isn't getting that either (and neither does WMIC command line), as far as I can see. I'm sure there is a relatively easy way of getting that as well, if you look close enough into the matter...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WINVER

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureProductName]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=ProductName
UpdateDivider=-1

[MeasureReleaseID]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=ReleaseId
UpdateDivider=-1

[MeasureCurrentBuild]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=CurrentBuild
UpdateDivider=-1

[MeasureUBR]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=UBR
UpdateDivider=-1

[MeasureWinBits]
Measure=String
String=%ProgramFiles(x86)%
RegExpSubstitute=1
Substitute="^(.+)$":"64","^$":"32"
UpdateDivider=-1

[MeterVersion]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=[MeasureProductName] Version [MeasureReleaseID] Build [MeasureCurrentBuild].[MeasureUBR] Architecture [MeasureWinBits]-bit
1.jpg
User avatar
Yincognito
Rainmeter Sage
Posts: 7020
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WINVER

Post by Yincognito »

jsmorley wrote: January 2nd, 2019, 4:54 pm

Code: Select all

[MeasureUBR]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=UBR
UpdateDivider=-1
Oh, thanks, jsmorley, it seems you can get the minor build number too - I don't know how I could miss that (maybe because it was the last key there)...

EDIT: Just for the record, the minor build number can also be found at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\CSDBuildNumber - interestingly, CSDVersion from the same path was used to store Windows XP's service pack number, so it might be for some strange Windows 10 backward compatibility reason...
jsmorley wrote: January 2nd, 2019, 4:54 pm

Code: Select all

[MeasureWinBits]
Measure=String
String=%ProgramFiles(x86)%
RegExpSubstitute=1
Substitute="^(.+)$":"64","^$":"32"
UpdateDivider=-1
Or ...

Code: Select all

[MeasureWinBits]
Measure=Plugin
Plugin=SysInfo
SysInfoType=OS_BITS
UpdateDivider=-1
RegExpSubstitute=1
Substitute="(^\s+|\s+$)":"","^(\S{1,3}).*$":"\1-bit","(^$|^0$)":"N/A-bit"
This whole thing actually benefits my skins too - I was just about to review my System skin, to query the new Win10 specific keys as well. ;-)
User avatar
siliconman01
Posts: 21
Joined: April 26th, 2015, 1:47 pm
Location: St. Albans, West Virginia USA

Re: WINVER

Post by siliconman01 »

Here is what I use for Windows 10:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureProductName]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=ProductName
UpdateDivider=-1

[MeasureReleaseID]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=DisplayVersion
UpdateDivider=-1

[MeasureCurrentBuild]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=CurrentBuild
UpdateDivider=-1

[MeasureUBR]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=UBR
UpdateDivider=-1

[MeasureWinBits]
Measure=String
String=%ProgramFiles(x86)%
RegExpSubstitute=1
Substitute="^(.+)$":"64","^$":"32"
UpdateDivider=-1

[MeterVersion]
Meter=String
FontSize=11
FontWeight=700
FontColor=126,228,68,255
;SolidColor=47,47,47,255
;SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=[MeasureProductName] Version [MeasureReleaseID] OS Build [MeasureCurrentBuild].[MeasureUBR]  [MeasureWinBits]-bit
Here is what I use for Windows 11:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureProductName]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=System\Setup\MoSetup\Volatile
RegValue=DownlevelProductName
UpdateDivider=-1

[MeasureReleaseID]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=DisplayVersion
UpdateDivider=-1

[MeasureCurrentBuild]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=CurrentBuild
UpdateDivider=-1

[MeasureUBR]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=UBR
UpdateDivider=-1

[MeasureWinBits]
Measure=String
String=%ProgramFiles(x86)%
RegExpSubstitute=1
Substitute="^(.+)$":"64","^$":"32"
UpdateDivider=-1

[MeterVersion]
Meter=String
FontSize=11
FontWeight=700
FontColor=126,228,68,255
;SolidColor=47,47,47,255
;SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=[MeasureProductName] Version [MeasureReleaseID] OS Build [MeasureCurrentBuild].[MeasureUBR]  [MeasureWinBits]-bit
win11 winver.png
User avatar
Yincognito
Rainmeter Sage
Posts: 7020
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WINVER

Post by Yincognito »

siliconman01 wrote: January 18th, 2023, 11:15 am Here is what I use for Windows 11:

Code: Select all

...

[MeasureProductName]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=System\Setup\MoSetup\Volatile
RegValue=DownlevelProductName
UpdateDivider=-1

...
Nice way to get the product name after MS let it unchanged in the old location (for "compatibility reasons", the usual excuse, except that it creates a whole new set of issues in other cases anyway) ... but as far as I could grasp, that HKEY_LOCAL_MACHINE\System\Setup\MoSetup registry path (and subpath) is present only if the system has been upgraded from a lower version, meaning that it's possible it won't be available for folks who do a clean install of Win 11.

Now, I'm not 100% sure about that and I don't have a way of testing other that in a virtual machine since I'm on Win 10, so I might be mistaken, but apparently the "recommended" way (obviously, by the same "competent" sources, to be gentle here) to retrieve it would be to test if the "CurrentBuild" part is greater than 22000 (or whatever the first Win 11 current build version was) and adjust the "product name version" accordingly. This is easily doable in Rainmeter via some Substitute options in a string measure and a Calc measure to compare.

Of course, the code will not be as "clean" as it was afterwards, but well ... it's Microsoft, it's not the first time their "technique" of patching the patches instead of building on a healthy and flexible foundation caused nausea for tons of users... :confused:
User avatar
siliconman01
Posts: 21
Joined: April 26th, 2015, 1:47 pm
Location: St. Albans, West Virginia USA

Re: WINVER

Post by siliconman01 »

You are most likely correct. My Win11 systems were originally Win10 updated by Windows Update.

I changed the last line in both the Win10 and Win11 code to:

Text=[MeasureProductName] [MeasureWinBits]-bit Version [MeasureReleaseID] (OS Build [MeasureCurrentBuild].[MeasureUBR])

This makes the display emulate the standard Windows WinVer app.
WinVer.png
Win11.png
Win10.png
User avatar
Yincognito
Rainmeter Sage
Posts: 7020
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WINVER

Post by Yincognito »

siliconman01 wrote: January 18th, 2023, 2:13 pm You are most likely correct. My Win11 systems were originally Win10 updated by Windows Update.

I changed the last line in both the Win10 and Win11 code to:

Text=[MeasureProductName] [MeasureWinBits]-bit Version [MeasureReleaseID] (OS Build [MeasureCurrentBuild].[MeasureUBR])

This makes the display emulate the standard Windows WinVer app.

WinVer.pngWin11.pngWin10.png
Looks good! Keep in mind though that the code will probably need the adjustment I mentioned earlier if you ever run the skin on a system where Win 11 was installed in a clean fashion (i.e. no upgrade), because the registry path you used could miss from such a system. Something like - and this is just one way of doing it:

Code: Select all

[Variables]
ProductNumber="\2"

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureCurrentBuild]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=CurrentBuild
UpdateDivider=-1
IfCondition=(MeasureCurrentBuild>=22000)
IfTrueAction=[!SetVariable ProductNumber "11"]

[MeasureProductName]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=ProductName
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^(.*?)(\d+)(.*?)$":"\1#ProductNumber#\3"
DynamicVariables=1

[MeasureReleaseID]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=DisplayVersion
UpdateDivider=-1

[MeasureUBR]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SOFTWARE\Microsoft\Windows NT\CurrentVersion
RegValue=UBR
UpdateDivider=-1

[MeasureWinBits]
Measure=String
String=%ProgramFiles(x86)%
RegExpSubstitute=1
Substitute="^(.+)$":"64","^$":"32"
UpdateDivider=-1

[MeterVersion]
Meter=String
FontSize=11
FontWeight=700
FontColor=126,228,68,255
SolidColor=0,0,0,255
SolidColor2=64,32,0,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=[MeasureProductName] [MeasureWinBits]-bit Version [MeasureReleaseID] (OS Build [MeasureCurrentBuild].[MeasureUBR])
Basically, in [MeasureProductName] we substitute the first number (since .*? means, when it comes to regular expressions, every character any number of times but as few as possible, and \d+ means any digit more than once) with the value of the ProductNumber variable.

The value of the product number variable will be either the default \2 (corresponding to the 2nd capture from the original product name, aka the (\d+) in the regular expression pattern), or 11 if [MeasureCurrentBuild] is greater than or equal to 22000 (we perform this test in the IfCondition from the current build measure, and since we need that result before we move on to the product name measure, we placed the former before the latter in the code).

For the record, if the IfCondition was executing before the Substitute (can't remember if that's the case here), we could have placed both in the product name measure, but then, better be on the safe side and leave them where they make more sense.

Note to myself: Adjust the code in my corresponding skin as well. If I decide to bother to correct the MS slip ups, that is. :Whistle
Post Reply