and this is two pieces of code I've used in my scripts for various things when working in a mixed 32/64bit environment.

 Code:
? @producttype + " " + iif(@onwow64,"64","32") + "bit"

$programfilesx86=iif(@onwow64,"%programfiles(x86)%","%programfiles%")
? $programfilesx86