<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CMD/BAT: Ветвление в пакетнике по номеру версии Win]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6170&amp;type=atom" />
	<updated>2011-09-01T18:29:27Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6170</id>
		<entry>
			<title type="html"><![CDATA[Re: CMD/BAT: Ветвление в пакетнике по номеру версии Win]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51039#p51039" />
			<content type="html"><![CDATA[<p>Немного переделал под свой зоопарк <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /><br /></p><div class="codebox"><pre><code>::::test_OS.cmd
@ FOR /F &quot;tokens=1,2* delims=[]&quot; %%a in (&#039;ver&#039;) DO @ (
        Echo.
        Echo %%a
    FOR /F &quot;tokens=1,2&quot; %%i in (&quot;%%b&quot;) DO @ (
        FOR /F &quot;tokens=1,2* delims=.&quot; %%v IN (&quot;%%j&quot;) DO @ ( 
                Echo ver %%v.%%w
            IF %%v==6 (
                Goto :OS_Win7 
            ) ELSE ( 
                IF %%w==1 Goto :OS_WINXP
                IF %%w==2 Goto :OS_WIN2003
            )
        ) 
    )
)


:OS_WIN2K
::: [run 2K-app...]
@ goto :TheEND

:OS_WINXP
::: [run XP-app...]
@ goto :TheEND

:OS_WIN2003
::: [run XP-app...]
@ goto :TheEND

:OS_Win7
::: [run Win7-app...]

 :TheEND
@Echo.
@Pause</code></pre></div>]]></content>
			<author>
				<name><![CDATA[chichva]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26880</uri>
			</author>
			<updated>2011-09-01T18:29:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51039#p51039</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CMD/BAT: Ветвление в пакетнике по номеру версии Win]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51012#p51012" />
			<content type="html"><![CDATA[<p>Скрипт основан на разборе выходных данных консольной команды VER средствами командной строки:<br /></p><div class="codebox"><pre><code>::::test_OS.cmd
@ FOR /F &quot;tokens=1,2* delims=[]&quot; %%a in (&#039;ver&#039;) DO @ (
    FOR /F &quot;tokens=1,2&quot; %%i in (&quot;%%b&quot;) DO @ (
        FOR /F &quot;tokens=1 delims=.&quot; %%v IN (&quot;%%j&quot;) DO @ ( 
            Echo ver # %%v
            IF %%v==6 Goto :OS_Win7 
        ) 
    )
)

:OS_WINXP
@ echo _____xp____
::: [run XP-app...]
@ goto :TheEND

:OS_Win7
@ echo _____win7____
::: [run Win7-app...]

 :TheEND
@Echo.
@Pause</code></pre></div><p>Понадобилось в батнике при работе под Win7 запускать иное, чем под WinXP, приложение. <br />Протестировано под XP rus/en и Win7 en.<br />Может кому пригодится еще, можете добавить в коллецию CMD-шных идей.</p>]]></content>
			<author>
				<name><![CDATA[Rom5]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5724</uri>
			</author>
			<updated>2011-09-01T06:07:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51012#p51012</id>
		</entry>
</feed>
