首页 > 其他分享 >判断机器类型(台式机,笔记本. . .)

判断机器类型(台式机,笔记本. . .)

时间:2022-10-12 13:12:55浏览次数:72  
标签:机器 log Temp% 笔记本 Value FoundPos 台式机 Match

3是台式机,10是笔记本,其他的看链接。

https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-systemenclosure?redirectedfrom=MSDN

type := cmdSilenceReturn("wmic path Win32_SystemEnclosure get ChassisTypes /value")
NeedleRegEx:="O)(\d+)"
Match := {Len: {0: 0}},  FoundPos := 1
FoundPos := RegExMatch(type, NeedleRegEx, Match, FoundPos + Match.Len[0])
;MsgBox,  % Match.Value(0)
If (Match.Value(0)=10){
    MsgBox, 笔记本
}
Else If (Match.Value(0)=3){
    MsgBox, 台式机
}
Return
cmdSilenceReturn(command){
    CMDReturn:=""
    cmdFN:="RunAnyCtrlCMD"
    try{
        RunWait,% ComSpec " /C " command " > ""%Temp%\" cmdFN ".log""",, Hide
        FileRead, CMDReturn, %A_Temp%\%cmdFN%.log
        FileDelete,%A_Temp%\%cmdFN%.log
    }catch{}
    return CMDReturn
}

 

标签:机器,log,Temp%,笔记本,Value,FoundPos,台式机,Match
From: https://www.cnblogs.com/ff888/p/16784170.html

相关文章