tags:

views:

85

answers:

3

Im using this code in XP 32bit os to get the %windir%\windows\system32 folder path.

sysFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.System)

What i want to know is that will this same code return the %windir%\windows\syswow64 folder when used in windows7 (64/32bit)?

A: 

Nope. On my Windows 7 64-bit box, targeting x64:

C:\Windows\system32
Michael Petrotta
A: 

I tried on my Windows7 box with .NET 4.0

This code:

Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.System));
Console.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86));

Prints the following from both 32- and 64-bit process:

C:\Windows\system32
C:\Windows\SysWOW64
Filip
+1  A: 

It will return c:\windows\system32, even in a 32-bit program that runs on the 64-bit version of Windows. Do not fix this, it doesn't need fixing. Because when you use that path, Windows will automatically remap it to c:\windows\syswow64. The file system redirector takes care of it.

Hans Passant