<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CMD/BAT: Определение сигнатуры ОС]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=4573&amp;type=atom" />
	<updated>2010-11-15T08:39:19Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=4573</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=41692#p41692" />
			<content type="html"><![CDATA[<p>Ради интереса проверил, что вернёт VER в следующих вариантах (все 32bit, русифицированные):<br />- XP Home + SP2: <strong>5.1.2600</strong>;<br />- XP Pro. + SP3: <strong>5.1.2600</strong>;<br />- Vista Bus. без SP: <strong>6.0.6000</strong>;<br />- Vista Bus. + SP1: <strong>6.0.6001</strong>;<br />- Vista Bus. + SP2: <strong>6.0.6002</strong><br />- 2008 Std. + SP2: <strong>6.0.6002</strong>.</p>]]></content>
			<author>
				<name><![CDATA[Dmitrii]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=13351</uri>
			</author>
			<updated>2010-11-15T08:39:19Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=41692#p41692</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=40450#p40450" />
			<content type="html"><![CDATA[<p>ver в <span style="color: blue">Server 2003 R2 Std. 32bit</span> вернёт <strong><span style="color: blue">5.2.xxxx</span></strong>, а в <span style="color: green">Server 2008 Std. 32bit</span> - <strong><span style="color: green">6.0.xxxx</span></strong></p>]]></content>
			<author>
				<name><![CDATA[Dmitrii]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=13351</uri>
			</author>
			<updated>2010-10-15T03:35:57Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=40450#p40450</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=40449#p40449" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>jite пишет:</cite><blockquote><p>B правда, совсем забыл про ver! <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /></p></blockquote></div><p>ver в семерке возвращает: Microsoft Windows [Version 6.1.7600]</p>]]></content>
			<author>
				<name><![CDATA[Celt]]></name>
			</author>
			<updated>2010-10-15T00:25:29Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=40449#p40449</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=40446#p40446" />
			<content type="html"><![CDATA[<p>B правда, совсем забыл про ver! <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[jite]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25851</uri>
			</author>
			<updated>2010-10-14T23:15:43Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=40446#p40446</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=40442#p40442" />
			<content type="html"><![CDATA[<p>вмик не канает, ибо недозволен простым смертным по дефолту, да и в винХП-дом отсутствует как класс, стрый дедовский метод вернее<br />(особо умные скажут - зафига такое спагетти, когда можно упростить - для совместимости) может есть касяки, лениво вспоминать и тестить<br /></p><div class="codebox"><pre><code>echo off
ver | find &quot; 9&quot;
if not errorlevel 1 goto win9x
ver | find &quot; 5.&quot;
if not errorlevel 1 goto win2k
ver | find &quot; 6.&quot;
if not errorlevel 1 goto vista
ver | find &quot; 7.&quot;
if not errorlevel 1 goto win7
echo XZ!
goto next
:win9x
echo win9x
goto next
:win2k
echo win2k
goto next
:vista
echo vista
goto next
:win7
echo win7
:next</code></pre></div>]]></content>
			<author>
				<name><![CDATA[smaharbA]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=2911</uri>
			</author>
			<updated>2010-10-14T19:47:45Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=40442#p40442</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=40438#p40438" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Windows 7&nbsp; &nbsp; &nbsp;6.1.7600<br />Windows Server 2008 R2 (ранее известна как Windows Server 7) 	6.1.7600</p></blockquote></div><p>Спасибо, что предупредили! <a href="http://ru.wikipedia.org/wiki/Microsoft_Windows#.D0.98.D1.81.D1.82.D0.BE.D1.80.D0.B8.D1.8F_.D0.B2.D1.8B.D0.BF.D1.83.D1.81.D0.BA.D0.BE.D0.B2_.D0.B2.D0.B5.D1.80.D1.81.D0.B8.D0.B9_Microsoft_Windows">Это&nbsp; действительно так <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /></a><br />Видимо, [странному] Microsoft это [побоку], как частенько бывает... <br />Что же делать?<br />Случаев, когда важны сразу платформа, версия, архитектура, сервер/нет ли, и чтобы это все в .cmd, наверное, не так уж и много. А в редких таковых придется строить громоздкие конструкции, улавливающие все особенности или делать консольную утилиту с реализацией на языке более высокого уровня, чтобы не морочиться с cmd.<br />****!</p>]]></content>
			<author>
				<name><![CDATA[jite]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25851</uri>
			</author>
			<updated>2010-10-14T16:11:32Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=40438#p40438</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=40435#p40435" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Евген пишет:</cite><blockquote><p>а не интересует заодно x86 или x64 ?</p></blockquote></div><p>Это, конечно, хорошо, но:<br /></p><div class="quotebox"><blockquote><p><strong>OSArchitecture</strong></p><p>Architecture of the operating system, as opposed to the processor.</p><p><em>Note: Windows Server 2003, Windows 2000, Windows NT 4.0, Windows XP, and Windows Me/98/95:&nbsp; This property is not available.</em></p></blockquote></div><p>а это 90% всех машин.<br /></p><div class="quotebox"><cite>jite пишет:</cite><blockquote><p>Под XP даст что-то вроде &quot;5.1.2600&quot;, под 7 - &quot;6.1.7600&quot;<br />B пожалуй да - по версии судить будет легче.</p></blockquote></div><p><a href="http://ru.wikipedia.org/wiki/Microsoft_Windows#.D0.98.D1.81.D1.82.D0.BE.D1.80.D0.B8.D1.8F_.D0.B2.D1.8B.D0.BF.D1.83.D1.81.D0.BA.D0.BE.D0.B2_.D0.B2.D0.B5.D1.80.D1.81.D0.B8.D0.B9_Microsoft_Windows">Оттуда</a> же:<br /></p><div class="quotebox"><blockquote><p>Windows 7&nbsp; &nbsp; &nbsp;6.1.7600<br />Windows Server 2008 R2 (ранее известна как Windows Server 7) 	6.1.7600</p></blockquote></div><p>Есть и другие совпадения.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2010-10-14T15:30:04Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=40435#p40435</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=40432#p40432" />
			<content type="html"><![CDATA[<p>С регулярными выражениями типа такого вполне пойдёт:<br /></p><div class="codebox"><pre><code>/^\S+\s\S+\s7\s.+$/ig</code></pre></div><p>Это значит &quot;Начало Слово Пробел Слово Пробел 7 Пробел Все-что-угодно Конец&quot;.<br /><strong>Upd</strong> Туплю-туплю! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> Мы же в пакетном файле а не под WSH!</p><p>Можно и версию посмотреть:<br /></p><div class="codebox"><pre><code>wmic.exe os get version</code></pre></div><p>Под XP даст что-то вроде &quot;5.1.2600&quot;, под 7 - &quot;6.1.7600&quot;. Vista, насколько помню, должна определяться как 6.0.чего-то-там<br />B пожалуй да - по версии судить будет легче.</p><p>Кстати, удобно смотреть, что еще можно нарыть с помощью следующего .cmd:<br /></p><div class="codebox"><pre><code>set alias=OS
wmic.exe %alias% list &gt;&gt; %alias%.txt</code></pre></div><p>Алиасы см. &quot;wmic /?&quot;</p>]]></content>
			<author>
				<name><![CDATA[jite]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25851</uri>
			</author>
			<updated>2010-10-14T14:43:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=40432#p40432</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=40431#p40431" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Microsoft Windows 7 Максимальная</code></pre></div><p>Думаю по Caption не пойдёт...&nbsp; &nbsp; у семёрки этих разновидностей....&nbsp; <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" />&nbsp; &nbsp;<br />ИМХО может как-то по версии ядра лучше ?:/<br />а не интересует заодно x86 или x64 ?<br /></p><div class="codebox"><pre><code>For Each objOS in GetObject(&quot;winmgmts:&quot;).InstancesOf (&quot;Win32_OperatingSystem&quot;)
WScript.Echo &quot;Version = &quot; &amp; objOS.Version  &amp; vbcrlf &amp; &quot;Architecture = &quot; &amp; objOS.OSArchitecture
Next</code></pre></div><p><a href="http://ru.wikipedia.org/wiki/Microsoft_Windows">Вот ссылка на нумерацию ядер</a></p>]]></content>
			<author>
				<name><![CDATA[Евген]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25253</uri>
			</author>
			<updated>2010-10-14T14:39:02Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=40431#p40431</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=40426#p40426" />
			<content type="html"><![CDATA[<p>Проще слепить всё в единый сценарий VBS, наподобие:<br /></p><div class="codebox"><pre><code>Option Explicit

Dim objSWbemObjectEx

With GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2&quot;)
    For Each objSWbemObjectEx In .ExecQuery(&quot;SELECT Caption FROM Win32_OperatingSystem WHERE Primary = True&quot;)
        &#039;WScript.Echo objSWbemObjectEx.Caption
        
        Select Case objSWbemObjectEx.Caption
            Case &quot;Microsoft Windows XP Professional&quot;, &quot;Microsoft Windows XP Home Edition&quot;
                Call Windows_XP
            Case &quot;-= Place here Captions from Windows Vista =-&quot;
                Call Windows_Vista
            Case &quot;-= Place here Captions from Windows 7 =-&quot;
                Call Windows_7
            Case Else
                &#039; Nothing to do
        End Select
    Next
End With

WScript.Quit 0

Sub Windows_XP
    &#039; Place here scenario from 1.vbs
    WScript.Echo &quot;Place here scenario from 1.vbs&quot;
End Sub

Sub Windows_Vista
    &#039; Place here scenario from 2.vbs
    WScript.Echo &quot;Place here scenario from 2.vbs&quot;
End Sub

Sub Windows_7
    &#039; Place here scenario from 3.vbs
    WScript.Echo &quot;Place here scenario from 3.vbs&quot;
End Sub</code></pre></div><p>Как выглядят «Caption» в случае «Vista» и «Windows 7» — не знаю, добавьте их в сценарий сами, перечислив возможные значения в соответствующих «Case …» через запятую.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2010-10-14T13:24:39Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=40426#p40426</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=40423#p40423" />
			<content type="html"><![CDATA[<p>Можете ли вы предложить сценарий, чтобы определить, какая операционная система, и если XP запустить 1.vbs скрипт и если Windows 7 запустить другой сценарий 2.vbs и если Vista запустить 3.vbs ....</p>]]></content>
			<author>
				<name><![CDATA[armenxxx1]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26102</uri>
			</author>
			<updated>2010-10-14T10:38:40Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=40423#p40423</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=39722#p39722" />
			<content type="html"><![CDATA[<p>Ух, спасибо! Богатая поляна у <a href="http://ss64.com/nt/wmic.html">wmic</a>! Про WMI конечно известно, но как-то не ожидал, что можно взять вот так просто, после обилия букв в WSH.</p>]]></content>
			<author>
				<name><![CDATA[jite]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25851</uri>
			</author>
			<updated>2010-09-27T20:31:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=39722#p39722</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=39711#p39711" />
			<content type="html"><![CDATA[<p>Есть. <a href="http://msdn.microsoft.com/en-us/library/aa394239%28VS.85%29.aspx">Win32_OperatingSystem Class</a>:<br /></p><div class="codebox"><pre><code>wmic.exe os get caption</code></pre></div>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2010-09-27T08:28:54Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=39711#p39711</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=39704#p39704" />
			<content type="html"><![CDATA[<p>А вот как отличить, скажем, Winows 7 от XP? Есть какой-нибудь более изящный способ, чем ниже?<br /></p><div class="codebox"><pre><code>@echo off
set res=%ALLUSERSPROFILE% | find &quot;ProgramData&quot;
if &quot;%res%&quot; neq &quot;&quot; (
rem win 7
set def_u_p=%homedrive%\Users\Default\ntuser.dat
) else (
rem win XP, 2000, ...
set def_u_p=&quot;%homedrive%\Documents and Settings\Default User\ntuser.dat&quot;
)
echo %def_u_p%</code></pre></div>]]></content>
			<author>
				<name><![CDATA[jite]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25851</uri>
			</author>
			<updated>2010-09-27T01:36:28Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=39704#p39704</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Определение сигнатуры ОС]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=36442#p36442" />
			<content type="html"><![CDATA[<p>Большое спасибо! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Poltergeyst]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=83</uri>
			</author>
			<updated>2010-06-08T14:31:49Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=36442#p36442</id>
		</entry>
</feed>
