我剛剛下載了7zip(x86和x64)的兩個.msi安裝程序。有沒有人有一個簡單的腳本,我可以用它來檢測操作系統體系結構並啓動相應的.msi文件?操作系統架構檢測腳本
0
A
回答
0
大概原油和不是很......「安全」 ...
只是檢查的C:\Program Files (x86)
其中存在只出現在64位系統上。
0
這可能幫助
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessors = objWMIService.ExecQuery _
("Select * From Win32_Processor")
For Each objProcessor in colProcessors
If objProcessor.Architecture = 0 Then
Wscript.Echo "This is an x86 computer."
ElseIf objProcessor.Architecture = 1 Then
Wscript.Echo "This is a MIPS computer."
ElseIf objProcessor.Architecture = 2 Then
Wscript.Echo "This is an Alpha computer."
ElseIf objProcessor.Architecture = 3 Then
Wscript.Echo "This is a PowerPC computer."
ElseIf objProcessor.Architecture = 5 Then
Wscript.Echo "This is a ARM computer."
ElseIf objProcessor.Architecture = 6 Then
Wscript.Echo "This is an ia64 computer."
ElseIf objProcessor.Architecture = 9 Then
Wscript.Echo "This is an x64 computer."
Else
Wscript.Echo "The computer type could not be determined."
End If
Next
0
你說的很簡單,但沒有指定的語言......
批次(CMD):
IF /I %PROCESSOR_ARCHITECTURE% EQU x86 (
msiexec /qn /i 7zip_x86.msi
) ELSE (
msiexec /qn /i 7zip_x86.msi
)
的VBScript(.VBS):
Set oShell = WScript.CreateObject("WScript.Shell")
proc_arch = oShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")
0
我發現一個很棒的vbscrip t,由Monimoy Sanyal撰寫,發佈在Microsoft Technet上。 如果32位系統在64位硬件上運行,它還會提供有關係統體系結構的信息。 https://gallery.technet.microsoft.com/scriptcenter/Determine-If-Your-System-969670e3
Option Explicit
Dim ObjWMI, ColSettings, ObjProcessor
Dim StrComputer, ObjNetwork
Set ObjNetwork = WScript.CreateObject("WScript.Network")
StrComputer = Trim(ObjNetwork.ComputerName)
Set ObjNetwork = Nothing
WScript.Echo VbCrLf & "Computer Name: " & StrComputer
WScript.Echo vbNullString
Set ObjWMI = GetObject("WINMGMTS:" & "{ImpersonationLevel=Impersonate,AuthenticationLevel=Pkt}!\\" & StrComputer & "\Root\CIMV2")
Set ColSettings = ObjWMI.ExecQuery ("SELECT * FROM Win32_Processor")
For Each ObjProcessor In ColSettings
Select Case ObjProcessor.Architecture
Case 0
WScript.Echo "Processor Architecture Used by the Platform: x86"
Case 6
WScript.Echo "Processor Architecture Used by the Platform: Itanium-Based System"
Case 9
WScript.Echo "Processor Architecture Used by the Platform: x64"
End Select
Select Case ObjProcessor.ProcessorType
Case 1
WScript.Echo "Processor Type: Other. Not in the Known List"
Case 2
WScript.Echo "Processor Type: Unknown Type"
Case 3
WScript.Echo "Processor Type: Central Processor (CPU)"
Case 4
WScript.Echo "Processor Type: Math Processor"
Case 5
WScript.Echo "Processor Type: DSP Processor"
Case 6
WScript.Echo "Processor Type: Video Processor"
End Select
WScript.Echo "Processor: " & ObjProcessor.DataWidth & "-Bit"
WScript.Echo "Operating System: " & ObjProcessor.AddressWidth & "-Bit"
WScript.Echo vbNullString
If ObjProcessor.Architecture = 0 AND ObjProcessor.AddressWidth = 32 Then
WScript.Echo "This Machine has 32 Bit Processor and Running 32 Bit OS"
End If
If (ObjProcessor.Architecture = 6 OR ObjProcessor.Architecture = 9) AND ObjProcessor.DataWidth = 64 AND ObjProcessor.AddressWidth = 32 Then
WScript.Echo "This Machine has 64-Bit Processor and Running 32-Bit OS"
End If
If (ObjProcessor.Architecture = 6 OR ObjProcessor.Architecture = 9) AND ObjProcessor.DataWidth = 64 AND ObjProcessor.AddressWidth = 64 Then
WScript.Echo "This Machine has 64-Bit Processor and Running 64-Bit OS"
End If
Next
Set ObjProcessor = Nothing: Set ColSettings = Nothing: Set ObjWMI = Nothing: StrComputer = vbNullstring
相關問題
- 1. 檢測系統架構
- 2. jQuery - 檢測操作系統和操作系統版本
- 3. 檢測外殼腳本中的Windows操作系統版本
- 4. C++檢測操作系統版本
- 5. 檢測操作系統
- 6. 開放源代碼雲操作系統/操作系統架構
- 7. 操作系統VBS腳本
- 8. Bash腳本操作系統檢測,如果和wget
- 9. 爲arm架構編寫操作系統
- 10. 爲x86架構開發操作系統
- 11. 針對Perl測試腳本的操作系統特定測試
- 12. CodeIgniter移動操作系統檢測
- 13. 檢測操作系統語言
- 14. 是否有宏檢測操作系統...?
- 15. 如何檢測操作系統
- 16. Dojo有/ sniff和操作系統檢測
- 17. 從Firefox擴展檢測操作系統
- 18. AVR USB檢測操作系統
- 19. 鼠標檢測,操作系統啓動
- 20. 在Clojure中檢測操作系統
- 21. 檢測操作系統級別的引發事件(操作系統外觀)
- 22. 檢查DLL操作系統版本
- 23. 檢查操作系統版本
- 24. 如何從Lua腳本中確定系統的操作系統?
- 25. 檢測瀏覽器和操作系統版本
- 26. 如何檢測Adobe AIR中的Android操作系統版本?
- 27. 如何使用宏檢測iPhone操作系統版本
- 28. 檢測操作系統版本 - Windows Phone 7或Windows Phone 8?
- 29. (C#)檢測Windows操作系統的類型(非本地化)
- 30. 檢測操作系統版本JavaScript和重定向