Windows 7 Environment Variable for System32 or SysWOW64
Asked Answered
F

1

13

Is there an environment variable to directly access System32 or SysWOW64 folder, respectively, in Windows 7 32bit or 64bit?

I know of a workaround by using %WINDIR%\System32 which is not working for me.

I have to re-compile an EXE that refers to some OCX that should be registered in System32 folder. The problem I am facing is that I have to install it in a 64bit system where the OCX got registered in SysWOW64 folder and not getting registered in System32 folder.

What should I try? Thanks for your help!

Edit:

I figured out that the solution has a reference to a dll which refers to flash10h.ocx. For this flash10h.ocx has to be registered. I could get it registered in SysWOW64 folder but not in System32. My system already has a flash player v11.xx. Will this not work?

Please help!

Foreignism answered 9/10, 2013 at 10:36 Comment(1)
Wrong!! On 64bit Windows: system32 = 64bit libs and syswow64 = 32bit libs (contrary what folder names suggest)Greysun
O
5

The following method will retrieve the path to the 32-bit system directory and, optionally, place it in the environment variable SYSDIR32.

public static String Get32BitSystemDirectory (Boolean placeInEnvironmentVariable = true)
{
   String sysDir = "";
   if (Environment.Is64BitOperatingSystem) sysDir = Environment.ExpandEnvironmentVariables("%windir%\\SysWOW64");
   else sysDir = Environment.ExpandEnvironmentVariables("%windir%\\System32");
   if (placeInEnvironmentVariable) Environment.SetEnvironmentVariable("SYSDIR32", sysDir, EnvironmentVariableTarget.User);
   return sysDir;
}
Outcrop answered 5/9, 2015 at 22:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.