12

I'd like to configure visual studio 2005 to copy .dll's based on whether the OS is 64-bit or 32-bit during a build.

I do not want to specify what the platform target is.

My first attempt was to use a batch file to lookup the Windows version, but some 32-bit and 64-bit versions of Windows share the same version number.

Anyone know of any way to check this?

Thanks!

LeeMobile
  • 3,775
  • 6
  • 31
  • 32

3 Answers3

7

You should be able to read the environment variable %PROCESSOR_ARCHITECTURE%. Here is some great information on it.

http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx

Community
  • 1
  • 1
Jon Tackabury
  • 47,710
  • 52
  • 130
  • 168
5

Check out isWow64, I think that shopuld give you what you are after.

Determines whether the specified process is running under WOW64.

Re0sless
  • 10,678
  • 6
  • 51
  • 66
  • I don't think that will be useful in the context of the question -- he doesn't want to write a C program; he just wants to copy some files during a builld. – Erik Knowles Jan 11 '11 at 18:39
2

Jon's link is a total hack because it relies upon no new processor architectures being added.

See: http://support.microsoft.com/kb/556009 for the "official" batch file method.

Erik Knowles
  • 999
  • 7
  • 15
  • This method is also not fooled by environment virtualization when a script is run using a 32-bit version of CSCRIPT.EXE/WSCRIPT.EXE on a 64-bit machine. It correctly reports what the processor *actually is*, instead of what SYSWOW64 *says* it is. – Gord Thompson Mar 27 '16 at 16:11