If you're specifically interested in getting the Program Files paths, it can be done with EnvGet.
Code:
EnvGet, ProgFiles32, ProgramFiles(x86)
if ProgFiles32 = ; Probably not on a 64-bit system.
EnvGet, ProgFiles32, ProgramFiles
EnvGet, ProgFiles64, ProgramW6432
MsgBox % "32: " ProgFiles32 "`n64: " ProgFiles64
I am running Windows 7 64-bit. If I type "set program" into a 64-bit command prompt (Start, type "cmd.exe"), it lists these variables:
Code:
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
Typing the same into a 32-bit command prompt (Start, type "C:\Windows\SysWow64\cmd.exe"), lists this:
Code:
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files (x86)
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
The environment variable
ProgramFiles appears to be consistent with AutoHotkey's
A_ProgramFiles (
A_ can be omitted), which actually uses the registry value ProgramFilesDir in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion. There are also other registry values containing the 32-bit and 64-bit paths, but I suppose the environment variables are easier to use.
If you want to detect whether the OS is 64-bit, you may use something like this:
Code:
if DllCall("IsWow64Process", "uint", DllCall("GetCurrentProcess"), "int*", isWow64process) && isWow64process
MsgBox This OS is 64-bit.
However, this method will not work if AutoHotkey is ever ported to 64-bit.

The following should continue to work (and can be used to retrieve
other system information):
Code:
VarSetCapacity(si,44)
DllCall("GetNativeSystemInfo", "uint", &si)
if ErrorLevel {
MsgBox Windows XP or later required.
ExitApp
}
arc := NumGet(si,0,"ushort")
MsgBox % arc=0 ? "x86" : arc=9 ? "x64" : arc=6 ? "IA64" : "UNKNOWN"