0
我試圖做一個非常簡單的代碼來檢測筆記本電腦架構。以下是代碼。我的筆記本電腦是64位的,但它也會顯示32位的消息框。是否還有其他遺漏代碼?檢測系統架構
#Load assembly
add-type -assemblyname system.windows.forms
#Assign messagebox to variable
$message1 = [System.Windows.Forms.MessageBox]::Show("This is a 64 bit version" , "Status")
$message2 = [System.Windows.Forms.MessageBox]::Show("This is a 32 bit version" , "Status")
#Display message based on the architecture
if ([System.Environment]::Is64BitProcess) {
echo $message1
} else {
echo $message2
}