判断机器类型(台式机,笔记本. . .)
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
}