Script per saber si l'ordinador corre amb 64 bits o 32 bits
Utilitzarem el següent codi escrit amb VBScript ( Visual Basic Script ) per detectar si l'ordinador corre amb 32 o 64 bit. El codi següent l'has d'enganxar a bloc de notes, guardar el fitxer amb l'extensió ".vbs" i l'executem.
info = get_OS_Bit(".")
wscript.echo info
Function get_OS_Bit(strComputer)
wscript.echo info
Function get_OS_Bit(strComputer)
const HKEY_LOCAL_MACHINE = &H80000002
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "HARDWARE\DESCRIPTION\System\CentralProcessor\0"
strValueName = "Identifier"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
if (instr(strValue,"x86")) then
Wscript.echo "El sistema tiene 32 bits."
get_OS_Bit="32"
elseif (instr(strValue,"64")) then
get_OS_Bit="64"
Wscript.echo "El sistema tiene 64 bits."
else
get_OS_Bit="NotSure"
wscript.echo "No se sabe."
end if
End Function
strKeyPath = "HARDWARE\DESCRIPTION\System\CentralProcessor\0"
strValueName = "Identifier"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
if (instr(strValue,"x86")) then
Wscript.echo "El sistema tiene 32 bits."
get_OS_Bit="32"
elseif (instr(strValue,"64")) then
get_OS_Bit="64"
Wscript.echo "El sistema tiene 64 bits."
else
get_OS_Bit="NotSure"
wscript.echo "No se sabe."
end if
End Function
Comentaris
Publica un comentari a l'entrada