<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; CMD/BAT: получение ProductKey установленной Windows]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=5197</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=5197&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «CMD/BAT: получение ProductKey установленной Windows».]]></description>
		<lastBuildDate>Sun, 21 Nov 2010 16:58:18 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[CMD/BAT: получение ProductKey установленной Windows]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=42034#p42034</link>
			<description><![CDATA[<div class="codebox"><pre><code>@echo off
setlocal enabledelayedexpansion

for /f &quot;tokens=3&quot; %%i in (&#039;reg.exe query &quot;HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion&quot; /v DigitalProductId&#039;) do (
    set x=%%~i
)

for /l %%z in (104, 2, 132) do (
    set /a array[%%z]=0x!x:~%%z,2!
)

call :GetKey
echo ProductKey: %GetKey%
rem pause &gt;nul

endlocal
exit /b 0

:GetKey
    setlocal enabledelayedexpansion
    set out=%~0
    set pc=BCDFGHJKMPQRTVWXY2346789
    set x=0
    for /l %%i in (0, 1, 28) do (
        if !x! gtr 28 goto :Break

        set a=0

        for /l %%j in (132, -2, 104) do (
            set /a a=array[%%j] + !a! * 256
            set /a array[%%j]=&quot;( !a! / 24 ) &amp; 255&quot;
            set /a a%%=24
            set /a n=%%j
        )

        for %%z in (!a!) do set key=!pc:~%%z,1!!key!
        set /a f=&quot;( !x! + 2 ) %% 6&quot;

        if !f! equ 0 if !x! lss 28 (
            set /a x+=1
            set key=-!key!
        )

        &lt;nul set /p sTemp=.
        set /a x+=1
    )
:Break
    echo.
    endlocal &amp; set %out:~1%=%key%
    exit /b</code></pre></div><p>Требуется наличие «reg.exe» в «PATH» (актуально для версий ниже Windows XP). См. также: <a href="http://forum.script-coding.com/viewtopic.php?id=522">VBScript: Получение ProductKey установленных Windows и MS Office</a>.</p><p>Автор идеи — <strong>smaharbA</strong>.</p>]]></description>
			<author><![CDATA[null@example.com (alexii)]]></author>
			<pubDate>Sun, 21 Nov 2010 16:58:18 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=42034#p42034</guid>
		</item>
	</channel>
</rss>
