It is currently March 28th, 2024, 9:51 pm

WINVER

General topics related to Rainmeter.
User avatar
siliconman01
Posts: 21
Joined: April 26th, 2015, 1:47 pm
Location: St. Albans, West Virginia USA

Re: WINVER

Post by siliconman01 »

I installed your code on my Win 11x64 Pro systems and it worked perfectly. So I'll keep using yours ;-)
Windows 10 x64 Pro on ASUS Homebuilt Pc. Windows 11x64 Pro on 512 gigabyte Dell XPS 15 2-in-1 Laptop/tablet.   Windows 11x64 Pro on 512 gigabyte Dell XPS 8940SE Pc.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WINVER

Post by Yincognito »

siliconman01 wrote: January 19th, 2023, 1:24 pm I installed your code on my Win 11x64 Pro systems and it worked perfectly. So I'll keep using yours ;-)
Excellent! :great: Feel free to improve it or adjust it if such a need arises in the future (e.g. add the appropriate condition for a hypothetical Windows 12 if that'll be the case) - like I said, this is just one way of doing it.

For the record, other ways to get some of the stuff you need would be, for example, to use the RunCommand plugin to get the ver output from the command line - which looks like Microsoft Windows [Version 10.0.19043.1202] on my system, but this has the drawback of not providing the product name and version. Or, you could use the same plugin to run systeminfo at the command line, though this again has the drawback of taking a bit too long to gather various data even if you could use a way to | findstr at the command line or | select in Powershell (which you can also use with RunCommand) to filter out information. In the past, running wmic os get caption, version, osarchitecture /format:list would have got you most of the information bar the "UBR" part at the command line, but its usage has been deprecated there, in favor of using it from Powershell via its equivalent Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object caption, version, osarchitecture | Format-List (which is - yet again - not as fast as the CMD.EXE variant).

So, you see, there are many ways to get to Rome, so to speak, but for sure the registry variant is one of the easiest and most comfortable ... until someone decides to screw it up by making things a bit more verbose than they should normally (and used to) be. :Whistle
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WINVER

Post by jsmorley »

I use this code to get all the product info...

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!CommandMeasure MeasureProductName "Run"]

[Variables]

[MeasureProductName]
Measure=Plugin
Plugin=RunCommand
OutputType=ANSI
Program=PowerShell
Parameter=(Get-WmiObject -class Win32_OperatingSystem).Caption
Substitute="#CRLF#":""
UpdateDivider=-1

[MeasureDisplayVersion]
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

[MeterDummy]
Meter=String

2.png
1.png
3.png


As has been said, there are several ways to come at this. However, after a long time of testing and messing, I have found that this approach is my preferred one, it has no "cheating" or ignoring the fact that the version info in the registry is just wrong with Windows 11. Note that Powershell is not the fastest thing ever when run from Rainmeter, mostly just some startup time for Powershell itself, but there is absolutely no reason to run any of this more than once per load/refresh of the skin. None of this can possibly change while the skin is running. So I don't really care that it isn't instant.
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WINVER

Post by Yincognito »

jsmorley wrote: January 20th, 2023, 12:51 amI use this code to get all the product info...
Excellent combination of methods. Me likes to stick with one, if possible, hence the "cheating"... :D
jsmorley wrote: January 20th, 2023, 12:51 am... or ignoring the fact that the version info in the registry is just wrong with Windows 11.
Apart from the obvious marketing, compatibility or annoyance considerations already mentioned, technically one could find a point in that reality, since after all, "Windows 11" is just another "major" version of Windows 10, to be blunt about it. Maybe this played a part in having those values in the registry, or even the fact that MS didn't want to break their "promise" of Windows 10 being the last version of Windows.

Anyway, don't ask one of their employees about it, they have the tendency of becoming really rude about it (check the reply of such an employee to the last comment by a perfectly logical user here). I mean, besides the fact that it's MS' fault, they have the audacity of calling folks expressing what literally everyone is thinking as "trolls" ... and for a paid product! I've seen this defiant attitude to user criticism on forums of other - incidentally, again paid - products as well, and it's one of the reasons I appreciate this one: firm, but cool, intelligent and reasonable heads and a helpful attitude overall ... and for a free product. Many others who make tons of money on the back of various users should learn from you. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth