Batch file for Windows7 32 and 64 bits

in a 64bit environment you will have an environment variable called

ProgramFiles(x86)

in a 32bit environment you do not have that variable. so you could check with

if defined ProgramFiles(x86) (
   REM do stuff for 64bit here
) else (
   REM do stuff for 32bit here
)

If you don't want to use a temp txt file use a pipe:

Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0
REG.exe Query %RegQry%  | Find /i "x86" 
If %ERRORLEVEL% == 0 (
    GOTO X86
) ELSE (
    GOTO X64
)


:X86

Commands here

GOTO END

:X64

commands here

:End

When you are using DEFINED, you must not enclose the variable name with % signs:

if defined ProgramFiles(x86) (
   :: do stuff for 64bit here
) else (
   :: do stuff for 32bit here
)