Sign in to follow this  
Followers 0
Dougiefresh

[Solved] OEM Information Generator

4 posts in this topic

#1 ·  Posted (edited)

Never mind. I solved my problem.

Edited by Dougiefresh

Share this post


Link to post
Share on other sites



I have a batch file that I need to convert to AutoIt. Can anybody help me? Any assistance would be appreciated! Thanks!

@echo off
Title=OEM info generator
mode con cols=59 lines=2
copy /v /y oemlogo.bmp %windir%\system32\oemlogo.bmp >nul
echo Please wait while system information is being generated...
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set OEMFILE=%SYSTEMROOT%\system32\oeminfo.ini
set REGMODE=1
set TAGFILE=WIN51
set MANUFACTURER=XP® Theme Source Patcher
set MODEL=v1.0.10b16 batch version 
set UPMAX=6
set UPNAMEL=8
set KEY=0
set KEYISVISIBLE=1
for %%d in (c d e f g h i j k l m n o p q r s t u v w x y z) do (if exist "%%d:\%TAGFILE%" set CDROM=%%d:&& goto metka)
:metka
if defined CDROM (
    set UPDATESDIR=%CDROM%\I386\SVCPACK
    set UPDATESMASK=*.*
) else (
    set CDROM=%~dp0
    set CDROM=!CDROM:~0,-7!
    set UPDATESDIR=%SYSTEMROOT%\system32\CatRoot\{F750E6C3-38EE-11D1-85E5-00C04FC295EE}
    set UPDATESMASK=KB*.*
)
for /F "tokens=1" %%j in ('reg 2^>nul') do if "%%j"=="REG" set REGEXE=rus
if exist "%CDROM%\I386\winn?.sif" (
    set WINNTSIF=%CDROM%\I386\winn?.sif
) else (
    if defined REGEXE (
        for /F "tokens=3 delims=    " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v SourcePath') do set SrcP=%%j
    ) else (
        for /F "tokens=3 delims= " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v SourcePath') do set SrcP=%%j
    )
    if exist "!SrcP!\winn?.sif" set WINNTSIF=!SrcP!\winn?.sif
)
if defined REGEXE (
    for /F "tokens=3 delims=    " %%j in ('reg query "HKCU\Control Panel\International" /v Locale') do set lang=%%j
    for /F "tokens=3 delims=    " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName') do set PN=%%j
    for /F "tokens=3 delims=    " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDVersion') do set CSDV=%%j
    for /F "tokens=3 delims=    " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion') do set CV=%%j
    for /F "tokens=3 delims=    " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v BuildLab') do set BUILD=%%j
) else (
    for /F "tokens=3 delims= " %%j in ('reg query "HKCU\Control Panel\International" /v Locale') do set lang=%%j
    for /F "tokens=3* delims= " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName') do set PN=%%j %%k
    for /F "tokens=3* delims= " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDVersion') do set CSDV=%%j %%k
    for /F "tokens=3 delims= " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion') do set CV=%%j
    for /F "tokens=3 delims= " %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v BuildLab') do set BUILD=%%j
)
for /F %%j in ('echo.%* ^| find /i /c "/k"') do if %%j==1 set KEY=1
for /F %%j in ('echo.%* ^| find /i /c "/v"') do if %%j==1 set KEYISVISIBLE=1
for /F %%j in ('echo.%* ^| find /i /c "/r"') do if %%j==1 set REGMODE=1
echo [General]> "%OEMFILE%"
echo Manufacturer=%MANUFACTURER%>> "%OEMFILE%"
echo Model=%MODEL%>> "%OEMFILE%"
if defined WINNTSIF (
    if %KEY% == 1 (
        for /F "tokens=3 delims==] " %%j in ('find /I /N "ProductKey" "%WINNTSIF%"') do set PK=%%j
    )
)
set i=1
set l=0
set c=0
set n=0

if %REGMODE% == 1 (
        for /F "tokens=5* delims=\" %%j in ('reg query "HKLM\SOFTWARE\Microsoft\Updates" /s ^| findstr /i /v "REG_ FileList"') do (
        if %ERRORLEVEL%==0 (
            for /F "usebackq tokens=3 delims=\" %%m in ('%%j\%%k') do (
                                set tmp=%%m       
                set tmp=!tmp:~0,%UPNAMEL%!
                set kb[!tmp!]=!tmp:~2,6!
            )
            for /F "tokens=2 delims=\" %%m in ('echo %%j\%%k^| findstr /i /c:" .NET"') do (
                set tmp=%%m       
                set tmp=!tmp:~0,%UPNAMEL%!
                set kb[!tmp!]=!tmp:~2,6!
            )
        )
    )
    for /F "tokens=7 delims=\" %%m in ('reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ^| findstr /i "\<KB[0-9][0-9][0-9][0-9][0-9][0-9]"') do (
        set tmp=%%m       
        set tmp=!tmp:~0,%UPNAMEL%!
        set kb[!tmp!]=!tmp:~2,6!
    )
    for /F %%j in ('set kb[') do set /A n+=1
    
    call :suppinfo
    for /F "tokens=2 delims=[]" %%j in ('set kb[ ^| sort') do (set kbname=%%j&& call :myprint)
) else (
    for /F %%j in ('dir /b /a:-d "%UPDATESDIR%\%UPDATESMASK%"') do set /A n+=1
    call :suppinfo
    for /F "tokens=1 delims=." %%j in ('dir /b /a:-d "%UPDATESDIR%\%UPDATESMASK%"') do (set kbname=%%j&&set kbname=!kbname!       &&set kbname=!kbname:~0,%UPNAMEL%!&& call :myprint)
)
goto :EOF
:myprint
if !c! == 0 (
    set str=!kbname!
) else (
    set str=!str!  !kbname!
)
set /A c+=1

if !c! == %UPMAX% (
    echo Line!i!=!str!>> "%OEMFILE%"
    set /A i+=1
    set /A l+=1
    set str=
    set c=0
    set /A tmp=n-l*UPMAX
) else (
    if %n% LSS %UPMAX% (
        if !c! == %n% (
            echo Line!i!=!str!>> "%OEMFILE%"
        )
    )
    if !tmp! LSS %UPMAX% (
        if !c! == !tmp! (
            echo Line!i!=!str!>> "%OEMFILE%"
        )
    )
)
goto :EOF

:suppinfo
if defined PK (
    if %KEYISVISIBLE% == 0 (
        echo [OEMSpecific]>> "%OEMFILE%"
        echo SerialNo=%PK%>> "%OEMFILE%"
        )
    )
)
echo [Support Information]>> "%OEMFILE%"
if %lang% == 00000419 (
    echo Line!i!=ÎÑ:%PN:Microsoft=% %CSDV:Service Pack=SP% âåðñèÿ %CV% ñáîðêà %BUILD%>> "%OEMFILE%"
) else (
    echo Line!i!=OS:%PN:Microsoft=% %CSDV:Service Pack=SP% version %CV% build %BUILD%>> "%OEMFILE%"
)
set /A i+=1
if defined PK (
    if %KEYISVISIBLE% == 1 (
        if %lang% == 00000419 (
            echo Line!i!=Êëþ÷ ïðîäóêòà: %PK%>> "%OEMFILE%"
        ) else (
            echo Line!i!=Product Key: %PK%>> "%OEMFILE%"
        )
        set /A i+=1
    )
)
echo Line!i!=>> "%OEMFILE%"
set /A i+=1
for /F %%t in ('time/T') do set T=%%t
if %lang% == 00000419 (
    echo Line!i!=Äàòà è âðåìÿ óñòàíîâêè ^(îáíîâëåíèÿ^): %date% ^(%T%^)>> "%OEMFILE%"
    set /A i+=1
    echo Line!i!=>> "%OEMFILE%"
    set /A i+=1
    echo Line!i!=Êîíòàêòíàÿ èíôîðìàöèÿ: http://forum.oszone.net/index.php?>> "%OEMFILE%"
    set /A i+=1
    echo Line!i!=>> "%OEMFILE%"
    set /A i+=1
    echo Line!i!=Óñòàíîâëåííûå êîìïîíåíòû è îáíîâëåíèÿ ^(%n%^):>> "%OEMFILE%"
) else (
    echo Line!i!=Installation ^(updation^) date and time: %date% ^(%T%^)>> "%OEMFILE%"
    set /A i+=1
    echo Line!i!=>> "%OEMFILE%"
    set /A i+=1
    echo Line!i!=Installed Components and Updates ^(%n%^):>> "%OEMFILE%"
)
set /A i+=1
echo Line!i!=>> "%OEMFILE%"
set /A i+=1
goto :EOF
You didn't say how far you get before getting stuck. Which parts are you having trouble with?

This forum does not provide translation services, but can help you do it yourself.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Never mind.... I figured it out. Stupid CMD syntax gave me headaches until I ran it through the command-line to figure out what it was getting. Thanks anyway!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0