- Find windows OS version from command line
- Find OS Version and Service Pack number from CMD
- Check Windows version using WMIC command
- Windows Version Numbers
- A list of Windows version numbers & major Windows builds
- Windows Version Numbers
- How to Update Windows
- Major Changes in Windows 10
- Version Класс
- Определение
- Примеры
- Комментарии
- Назначение сведений о версии сборкам Assigning Version Information to Assemblies
- Получение сведений о версии Retrieving Version Information
- Сравнение объектов версии Comparing Version Objects
- Конструкторы
- Свойства
- Методы
- Операторы
- Явные реализации интерфейса
Find windows OS version from command line
Windows has command line utilities that show us the version of the Windows OS running on the computer, including the service pack number. There are multiple CMD commands that help with finding this, you can pick the one that suits your need. Ver command can show you the OS version whereas Systeminfo command can additionally give you service pack, OS edition and build number etc.
Find OS Version and Service Pack number from CMD
As you can see above, ver command shows only OS version but not the service pack number. We can find service pack number as well with Systeminfo command. Systeminfo dumps lot of other information too, which we can filter out using findstr command.
This command works on XP, Vista and Windows 7 and on Server editions also. Find below example for Win7.
In case of Windows 7 SP1, the output would be slightly different as below.
If you want to print more details, then you can use just ‘OS’ in the findstr search pattern. See example below for Server 2008.
Check Windows version using WMIC command
Run the below WMIC command to get OS version and the service pack number.
Example on Windows 7:
If you want to find just the OS version, you can use ver command. Open command window and execute ver command. But note that this does not show service pack version.
This command does not show version on a Windows 7 system.
Windows Version Numbers
A list of Windows version numbers & major Windows builds
Each Microsoft Windows operating system has a familiar name, like Windows 10 or Windows Vista, but behind each common name is an actual Windows version number 1 .
You can determine your Windows version a number of ways if you want to check which build number you’re currently running.
Windows Version Numbers
Below is a list of major Windows versions and their associated version numbers:
Reference Table for Windows Version Numbers | ||
---|---|---|
Operating System | Version Details | Version Number |
Windows 10 | Windows 10 (20H2) | 10.0.19042 |
Windows 10 (2004) | 10.0.19041 | |
Windows 10 (1909) | 10.0.18363 | |
Windows 10 (1903) | 10.0.18362 | |
Windows 10 (1809) | 10.0.17763 | |
Windows 10 (1803) | 10.0.17134 | |
Windows 10 (1709) | 10.0.16299 | |
Windows 10 (1703) | 10.0.15063 | |
Windows 10 (1607) | 10.0.14393 | |
Windows 10 (1511) | 10.0.10586 | |
Windows 10 | 10.0.10240 | |
Windows 8 | Windows 8.1 (Update 1) | 6.3.9600 |
Windows 8.1 | 6.3.9200 | |
Windows 8 | 6.2.9200 | |
Windows 7 | Windows 7 SP1 | 6.1.7601 |
Windows 7 | 6.1.7600 | |
Windows Vista | Windows Vista SP2 | 6.0.6002 |
Windows Vista SP1 | 6.0.6001 | |
Windows Vista | 6.0.6000 | |
Windows XP | Windows XP 2 | 5.1.2600 3 |
[1] More specific than a version number, at least in Windows, is a build number, often indicating exactly what major update or service pack has been applied to that Windows version. This is the last number shown in the version number column, like 7600 for Windows 7. Some sources note the build number in parenthesis, like 6.1 (7600).
[2] Windows XP Professional 64-bit had its own version number of 5.2. As far as we know, that’s the only time Microsoft has designated a special version number for a specific edition and architecture-type of a Windows operating system.
[3] Service pack updates to Windows XP did update the build number but in a very minor and long-winded way. For example, Windows XP with SP3 and other small updates is listed as having a version number of 5.1 (Build 2600.xpsp_sp3_qfe.130704-0421 : Service Pack 3).
How to Update Windows
To update Windows to the newest build number, use Windows Update. Using the built-in Windows Update utility is the easiest way to check for and install Windows updates.
If your version of Windows isn’t currently set up to install updates automatically, you can change the Windows Update settings so that new updates are downloaded and applied automatically. This is the simplest way to keep Windows updated to the latest version number.
Major Changes in Windows 10
Microsoft introduced several changes to the Windows operating system with the release of Windows 10. These are some of the biggest differences between Windows 10 and Windows 8 (and older versions of Windows):
Version Класс
Определение
Представляет номер версии сборки, операционной системы или среды CLR. Represents the version number of an assembly, operating system, or the common language runtime. Этот класс не наследуется. This class cannot be inherited.
Примеры
В следующем примере атрибут используется AssemblyVersionAttribute для присвоения номера версии сборке. The following example uses the AssemblyVersionAttribute attribute to assign a version number to an assembly. Во время компиляции сведения о версии хранятся в метаданных сборки. At compile time, this version information is stored with the assembly’s metadata. Во время выполнения в примере извлекается значение Type.Assembly свойства для типа, найденного в сборке, чтобы получить ссылку на выполняемую сборку, и получает сведения о версии сборки из Version свойства AssemblyName объекта, возвращаемого Assembly.GetName методом. At run time, the example retrieves the value of the Type.Assembly property on a type found in the assembly to get a reference to the executing assembly, and it retrieves the assembly’s version information from the Version property of the AssemblyName object returned by the Assembly.GetName method.
Комментарии
Номера версий состоят из двух и четырех компонентов: основной, дополнительный, сборка и редакция. Version numbers consist of two to four components: major, minor, build, and revision. Основной и дополнительный компоненты являются обязательными; компоненты сборки и редакции необязательны, но компонент сборки является обязательным, если определен компонент редакции. The major and minor components are required; the build and revision components are optional, but the build component is required if the revision component is defined. Все определенные компоненты должны быть целыми числами больше или равными 0. All defined components must be integers greater than or equal to 0. Формат номера версии выглядит следующим образом (дополнительные компоненты показаны в квадратных скобках ([и]): The format of the version number is as follows (optional components are shown in square brackets ([ and ]):
Эти компоненты используются в соответствии со следующим соглашением: The components are used by convention as follows:
Основные: сборки с одинаковыми именами, но разными основными версиями не взаимозаменяемы. Major: Assemblies with the same name but different major versions are not interchangeable. Более высокий номер версии может указывать на значительную перезапись продукта, в которой невозможно предположить обратную совместимость. A higher version number might indicate a major rewrite of a product where backward compatibility cannot be assumed.
Дополнительный: Если имя и основной номер версии в двух сборках совпадают, но дополнительный номер версии отличается, это указывает на значительное улучшение с намерением обратной совместимости. Minor: If the name and major version number on two assemblies are the same, but the minor version number is different, this indicates significant enhancement with the intention of backward compatibility. Этот больший дополнительный номер версии может указывать на выпуск точки продукта или полностью обратно совместимую версию продукта. This higher minor version number might indicate a point release of a product or a fully backward-compatible new version of a product.
Сборка: разница в номере сборки представляет собой повторную компиляцию того же источника. Build: A difference in build number represents a recompilation of the same source. При изменении процессора, платформы или компилятора могут использоваться разные номера сборок. Different build numbers might be used when the processor, platform, or compiler changes.
Редакция. сборки с одинаковыми именами, основными и дополнительными номерами версий, но разными редакциями, должны быть полностью взаимозаменяемыми. Revision: Assemblies with the same name, major, and minor version numbers but different revisions are intended to be fully interchangeable. Более высокий номер редакции может использоваться в сборке, которая устраняет брешь в системе безопасности в ранее выпущенной сборке. A higher revision number might be used in a build that fixes a security hole in a previously released assembly.
Последующие версии сборки, отличающиеся только номерами сборки или редакции, считаются исправлениями предыдущей версии. Subsequent versions of an assembly that differ only by build or revision numbers are considered to be Hotfix updates of the prior version.
Значение Version свойств, которым не было явно назначено значение, не определено (-1). The value of Version properties that have not been explicitly assigned a value is undefined (-1).
Начиная с платформа .NET Framework 2,0, MajorRevision Свойства и MinorRevision позволяют задать временную версию приложения, которая, например, устраняет проблему, пока не будет выпущено постоянное решение. Starting with .NET Framework 2.0, the MajorRevision and MinorRevision properties enable you to identify a temporary version of your application that, for example, corrects a problem until you can release a permanent solution. Кроме того, операционная система Windows NT использует MajorRevision свойство для кодирования номера пакета обновления. Furthermore, the Windows NT operating system uses the MajorRevision property to encode the service pack number.
Назначение сведений о версии сборкам Assigning Version Information to Assemblies
Обычно Version класс не используется для присвоения номера версии сборке. Ordinarily, the Version class is not used to assign a version number to an assembly. Вместо этого AssemblyVersionAttribute класс используется для определения версии сборки, как показано в примере в этом разделе. Instead, the AssemblyVersionAttribute class is used to define an assembly’s version, as illustrated by the example in this topic.
Получение сведений о версии Retrieving Version Information
Version объекты чаще всего используются для хранения сведений о версии некоторых компонентов системы или приложений (таких как операционная система), среды CLR, исполняемого файла текущего приложения или конкретной сборки. Version objects are most frequently used to store version information about some system or application component (such as the operating system), the common language runtime, the current application’s executable, or a particular assembly. В следующих примерах показаны некоторые из наиболее распространенных сценариев. The following examples illustrate some of the most common scenarios:
Получение версии операционной системы. Retrieving the operating system version. В следующем примере свойство используется OperatingSystem.Version для получения номера версии операционной системы. The following example uses the OperatingSystem.Version property to retrieve the version number of the operating system.
Получение версии среды CLR. Retrieving the version of the common language runtime. В следующем примере свойство используется Environment.Version для получения сведений о версии среды CLR. The following example uses the Environment.Version property to retrieve version information about the common language runtime.
Получение версии сборки текущего приложения. Retrieving the current application’s assembly version. В следующем примере метод используется Assembly.GetEntryAssembly для получения ссылки на Assembly объект, представляющий исполняемый файл приложения, а затем извлекает его номер версии сборки. The following example uses the Assembly.GetEntryAssembly method to obtain a reference to an Assembly object that represents the application executable and then retrieves its assembly version number.
Получение версии сборки текущей сборки. Retrieving the current assembly’s assembly version. В следующем примере свойство используется Type.Assembly для получения ссылки на Assembly объект, представляющий сборку, содержащую точку входа приложения, а затем извлекает сведения о его версии. The following example uses the Type.Assembly property to obtain a reference to an Assembly object that represents the assembly that contains the application entry point, and then retrieves its version information.
Получение версии определенной сборки. Retrieving the version of a specific assembly. В следующем примере метод используется Assembly.ReflectionOnlyLoadFrom для получения ссылки на Assembly объект с определенным именем файла, а затем извлекает сведения о его версии. The following example uses the Assembly.ReflectionOnlyLoadFrom method to obtain a reference to an Assembly object that has a particular file name, and then retrieves its version information. Обратите внимание, что для создания Assembly объекта по имени файла или по строгому имени также существует несколько других методов. Note that several other methods also exist to instantiate an Assembly object by file name or by strong name.
Получение версии публикации приложения ClickOnce. Retrieving the Publish Version of a ClickOnce application. В следующем примере свойство используется ApplicationDeployment.CurrentVersion для вывода версии публикации приложения. The following example uses the ApplicationDeployment.CurrentVersion property to display an application’s Publish Version. Обратите внимание, что для успешного выполнения требуется задать удостоверение приложения в примере. Note that its successful execution requires the example’s application identity to be set. Это автоматически обрабатывается мастером публикации Visual Studio. This is handled automatically by the Visual Studio Publish Wizard.
Версия публикации приложения для развертывания ClickOnce полностью не зависит от версии ее сборки. The Publish Version of an application for ClickOnce deployment is completely independent of its assembly version.
Сравнение объектов версии Comparing Version Objects
С помощью метода можно CompareTo определить, является ли один Version объект более ранним, чем второй, или более поздним Version . You can use the CompareTo method to determine whether one Version object is earlier than, the same as, or later than a second Version object. В следующем примере указывается, что версия 2,1 более поздняя, чем версия 2,0. The following example indicates that Version 2.1 is later than Version 2.0.
Чтобы две версии были равны, номера основного, дополнительного, сборки и редакции первого Version объекта должны быть идентичны значениям второго Version объекта. For two versions to be equal, the major, minor, build, and revision numbers of the first Version object must be identical to those of the second Version object. Если номер сборки или редакции Version объекта не определен, этот Version объект считается более ранним, чем Version объект, номер сборки или номера редакции которого равен нулю. If the build or revision number of a Version object is undefined, that Version object is considered to be earlier than a Version object whose build or revision number is equal to zero. В следующем примере показано, как сравнить три Version объекта с неопределенными компонентами версии. The following example illustrates this by comparing three Version objects that have undefined version components.
Конструкторы
Инициализирует новый экземпляр класса Version. Initializes a new instance of the Version class.
Инициализирует новый экземпляр класса Version с помощью указанных основного и дополнительного номеров версии. Initializes a new instance of the Version class using the specified major and minor values.
Инициализирует новый экземпляр класса Version с помощью указанных основного и дополнительного номеров версии и номера построения. Initializes a new instance of the Version class using the specified major, minor, and build values.
Инициализирует новый экземпляр класса Version с помощью указанных основного и дополнительного номеров версии, номера построения и номера редакции. Initializes a new instance of the Version class with the specified major, minor, build, and revision numbers.
Инициализирует новый экземпляр класса Version, используя указанную строку. Initializes a new instance of the Version class using the specified string.
Свойства
Возвращает значение компонента текущего объекта Version, представляющего в номере версии номер построения. Gets the value of the build component of the version number for the current Version object.
Получает значение компонента текущего объекта Version, представляющего в номере версии основной номер. Gets the value of the major component of the version number for the current Version object.
Возвращает старшие 16 разрядов номера редакции. Gets the high 16 bits of the revision number.
Возвращает значение компонента текущего объекта Version, представляющего в номере версии дополнительный номер. Gets the value of the minor component of the version number for the current Version object.
Возвращает младшие 16 разрядов номера редакции. Gets the low 16 bits of the revision number.
Возвращает значение компонента текущего объекта Version, представляющего в номере версии номер редакции. Gets the value of the revision component of the version number for the current Version object.
Методы
Возвращает новый объект Version, значение которого совпадает со значением текущего объекта Version. Returns a new Version object whose value is the same as the current Version object.
Сравнивает текущий объект Version с заданным объектом и возвращает сведения об их относительных значениях. Compares the current Version object to a specified object and returns an indication of their relative values.
Сравнивает текущий объект Version с заданным объектом Version и возвращает сведения об их относительных значениях. Compares the current Version object to a specified Version object and returns an indication of their relative values.
Возвращает значение, позволяющее определить, равен ли текущий объект Version указанному. Returns a value indicating whether the current Version object is equal to a specified object.
Возвращает значение, позволяющее определить, представляют ли текущий объект Version и заданный объект Version одно и то же значение. Returns a value indicating whether the current Version object and a specified Version object represent the same value.
Возвращает хэш-код для текущего объекта Version. Returns a hash code for the current Version object.
Возвращает объект Type для текущего экземпляра. Gets the Type of the current instance.
(Унаследовано от Object)
Создает неполную копию текущего объекта Object. Creates a shallow copy of the current Object.
(Унаследовано от Object)
Преобразует указанный диапазон символов только для чтения, представляющий номер версии, в эквивалентный объект Version. Converts the specified read-only span of characters that represents a version number to an equivalent Version object.
Преобразует строковое представление номера версии в эквивалентный объект Version. Converts the string representation of a version number to an equivalent Version object.
Преобразует значение текущего объекта Version в эквивалентное ему представление String. Converts the value of the current Version object to its equivalent String representation.
Преобразует значение текущего объекта Version в эквивалентное ему представление String. Converts the value of the current Version object to its equivalent String representation. Заданное количество обозначает число возвращаемых компонент. A specified count indicates the number of components to return.
Пытается отформатировать этот экземпляр версии в диапазон символов. Tries to format this version instance into a span of characters.
Пытается отформатировать этот экземпляр версии в диапазон символов. Tries to format this version instance into a span of characters.
Предпринимает попытку преобразования указанного диапазона символов только для чтения, представляющего номер версии, в эквивалентный объект Version и возвращает значение, позволяющее определить, успешно ли выполнено преобразование. Tries to convert the specified read-only span of characters representing a version number to an equivalent Version object, and returns a value that indicates whether the conversion succeeded.
Предпринимает попытку преобразования строкового представления номера версии в эквивалентный объект Version и возвращает значение, позволяющее определить, успешно ли выполнено преобразование. Tries to convert the string representation of a version number to an equivalent Version object, and returns a value that indicates whether the conversion succeeded.
Операторы
Определение равенства двух заданных объектов Version. Determines whether two specified Version objects are equal.
Определяет, действительно ли значение первого указанного объекта Version больше значения второго указанного объекта Version. Determines whether the first specified Version object is greater than the second specified Version object.
Определяет, является ли значение первого указанного объекта Version большим или равным значению второго указанного объекта Version. Determines whether the first specified Version object is greater than or equal to the second specified Version object.
Определение неравенства двух заданных объектов Version. Determines whether two specified Version objects are not equal.
Определяет, меньше ли значение первого указанного объекта Version, чем значение второго указанного объекта Version. Determines whether the first specified Version object is less than the second specified Version object.
Определяет, действительно ли значение первого указанного объекта Version меньше или равно значению второго указанного объекта Version. Determines whether the first specified Version object is less than or equal to the second Version object.
Явные реализации интерфейса
Сравнивает текущий объект Version с заданным объектом и возвращает сведения об их относительных значениях. Compares the current Version object to a specified object and returns an indication of their relative values.