;; 
;;=====================================================================================----- 
;; 
;;FUNCTION       Arch() / Is64Bit() 
;; 
;;ACTION         Returns a value depending on OS architecture (not CPU architecture) 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0  - 2012/10/13 
;; 
;;HISTORY        1.0  - 2012/10/13 - Initial Release 
;; 
;;SYNTAX         Arch() 
;; 
;;PARAMETERS     none 
;; 
;;REMARKS        Two UDFs that return a string or value based on the OS Architecture. 
;; 
;;RETURNS        Arch(): String "x86" or "x64" / Is64Bit(): Int 0=32 bit, 1=64-bit 
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    W2K3, W2K8, W2K12, WinXP, Win7/8 
;; 
;;EXAMPLES       ; create the installer filename based on OS platform 
;;               $File = 'AppInstall_' + Arch() + '.exe' 
;; 
;;               ; Run different commands on 32-bit or 64-bit platforms 
;;               If Is64Bit() 
;;                 ; x64 command 
;;               Else 
;;                 ; x86 command 
;;               EndIf 
; 
Function Arch()
 
  $Arch = IIf(InStr('%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%', 'AMD64'), 'x64', 'x86')
 
  Exit 0
 
EndFunction
 
 
Function Is64Bit()
 
  $Is64Bit= IIf(InStr('%PROCESSOR_ARCHITECTURE% %PROCESSOR_ARCHITEW6432%', 'AMD64'), 1, 0)
 
  Exit 0
 
EndFunction