Windows – How to a 32-bit cmd.exe launch a 64-bit cmd.exe on Windows Server 2003 x64

32bit-64bitcmdwindows

This is a follow up to 7-Zip execution permissions on Windows Server 2008 64-bit.

I'm trying to avoid having an overly complicated build process to make multiple 7-Zip EXE files. I just need a .cmd to kick off my Java process after reading some 64-bit registry entries. However, to succeed with a single EXE file, it needs to be 32 bit.

The above question found a trick for getting Windows Server 2008 to detect a 32 bit cmd.exe and swap it to 64 bit. Is there a way to do this on Windows Server 2003? There's a Windows hotfix that allows reg.exe to access 64-bit entries in 32-bit mode, but I can't be assured that's on the customer's server so that workaround is a no go.

Best Answer

To launch 64-bit cmd.exe from 32-bit cmd.exe you must be able to access c:\Windows\System32 folder without being redirected to c:\Windows\SysWow64 folder. In Win2008 you can achieve this by accessing c:\Windows\Sysnative path. Unfortunately on Win2003 a hotfix is required (see http://support.microsoft.com/kb/942589).

There is a workaround - you can create an NTFS junction point that directs to c:\Windows\System32 folder and use path to that junction point instead of c:\Windows\System32. Using System Internals' junction.exe I managed to create such a junction point from 32-bit cmd.exe and launch 64-bit cmd.exe.