自动脚本不起作用

时间:2014-09-11 02:33:09

标签: find version autoit

我不知道为什么这个自动脚本无效!我需要识别Windows版本和arhitecture  '

    If @OSTYPE = "WIN32_WINDOWS" Then
        ;If @OSType = "WIN32_NT" Then
        _AddLineBox("Unsupported Windws version. Use only on 2000/XP/2003 x32/64.")

    Else
        If @CPUArch = "X86 Then


            If @OSVersion = "WIN_XP" Then _AddLineBox("Detecting Windows version - Windows XP x32")
            If @OSVersion = "WIN_2000" Then _AddLineBox("Detecting Windows version - Windows 2000 x32")
            If @OSVersion = "WIN_2003" Then _AddLineBox("Detecting Windows version - Windows 2003 x32")
        EndIf
        If @CPUArch = "64-bit" Then


            If @OSVersion = "WIN_XP" Then _AddLineBox("Detecting Windows version - Windows XP x64")
            If @OSVersion = "WIN_2000" Then _AddLineBox("Detecting Windows version - Windows 2000 x64")
            If @OSVersion = "WIN_2003" Then _AddLineBox("Detecting Windows version - Windows 2003 x64")
        EndIf
    EndIf
EndFunc   ;==>DetectInfrastructure

'

2 个答案:

答案 0 :(得分:0)

似乎正在进行微小的改动。

ConsoleWrite("OSType is " & @OSType & @CRLF)

If @OSTYPE = "WIN32_WINDOWS" Then
    ;If @OSType = "WIN32_NT" Then
    ConsoleWrite("Unsupported Windows version. Use only on 2000/XP/2003 x32/64." & @CRLF)
Else
    ConsoleWrite("Supported Windows version found." & @CRLF)

    ConsoleWrite("CPUArch is " & @CPUArch & " , OSVersion is " & @OSVersion & @CRLF)

    If @CPUArch = "X86" Then
        If @OSVersion = "WIN_XP" Then ConsoleWrite("Detecting Windows version - Windows XP X86" & @CRLF)
        If @OSVersion = "WIN_2000" Then ConsoleWrite("Detecting Windows version - Windows 2000 X86" & @CRLF)
        If @OSVersion = "WIN_2003" Then ConsoleWrite("Detecting Windows version - Windows 2003 X86" & @CRLF)
    Else
        If @OSVersion = "WIN_XP" Then ConsoleWrite("Detecting Windows version - Windows XP X64" & @CRLF)
        If @OSVersion = "WIN_2000" Then ConsoleWrite("Detecting Windows version - Windows 2000 X64" & @CRLF)
        If @OSVersion = "WIN_2003" Then ConsoleWrite("Detecting Windows version - Windows 2003 X64" & @CRLF)
    EndIf
EndIf

这适用于我的笔记本电脑和打印:

OSType is WIN32_NT
Supported Windows version found.
CPUArch is X64 , OSVersion is WIN_7

答案 1 :(得分:0)

我已经为你编写了这个脚本:

if @OSVersion="WIN_81"then $os="Windows 8.1"
if @OSVersion="WIN_8"then $os="Windows 8"
if @OSVersion="WIN_7"then $os="Windows 7"
if @OSVersion="WIN_VISTA"then $os="Windows Vista"
if @OSVersion="WIN_XP"then $os="Windows XP"
if @OSVersion="WIN_XPe"then $os="Windows XPE"
if @OSVersion="WIN_2012R2"then $os="Windows Server 2012 R2"
if @OSVersion="WIN_2012"then $os="Windows Server 2012"
if @OSVersion="WIN_2008R2"then $os="Windows Server 2008 R2"
if @OSVersion="WIN_2008"then $os="Windows Server 2008"
if @OSVersion="WIN_2003"then $os="Windows Server 2003"
If @OSArch="X86" Then $os=$os&" 32bit"
If @OSArch="X64" Then $os=$os&" 64bit"
If @OSArch="IA64" Then $os=$os&" 64bit"
If StringRight(@OSLang, 2)="07" Then $os=$os&" German"
If StringRight(@OSLang, 2)="09" Then $os=$os&" English"
If StringRight(@OSLang, 2)="0a" Then $os=$os&" Spanish"
If StringRight(@OSLang, 2)="0b" Then $os=$os&" Finnish"
If StringRight(@OSLang, 2)="0c" Then $os=$os&" French"
If StringRight(@OSLang, 2)="10" Then $os=$os&" Italian"
If StringRight(@OSLang, 2)="13" Then $os=$os&" Dutch"
If StringRight(@OSLang, 2)="14" Then $os=$os&" Norwegian"
If StringRight(@OSLang, 2)="15" Then $os=$os&" Polish"
If StringRight(@OSLang, 2)="16" Then $os=$os&" Portuguese"
If StringRight(@OSLang, 2)="1d" Then $os=$os&" Swedish"
ConsoleWrite("Detecting Windows version - "&$os & @CRLF)

它可以检测到大多数Windows操作系统返回到Windows 98,它还可以检测语言。