3是台式机,10是笔记本,其他的看链接。
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