Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 7 Environment Variable for System32 or SysWOW64

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!

like image 595
Vivek Jain Avatar asked Oct 09 '13 10:10

Vivek Jain


People also ask

Should SysWOW64 be in path?

If you have a 32bit application trying to start them, you would put them in the SysWOW64 directory. If you have a 64bit application trying to start them, they would go in the System32 directory. If you want to access the real System32 directory from a 32bit application, you can use the special SysNative directory.

What is the system variable for the Windows folder?

The Windows System folder. A typical path is C:\Windows\System32. The Windows directory or system root. This corresponds to the %WINDIR% or %SYSTEMROOT% environment variables.

How do I find the Windows environment variable in CMD?

On WindowsSelect Start > All Programs > Accessories > Command Prompt. In the command window that opens, enter set. A list of all the environment variables that are set is displayed in the command window.

What are Windows environment variables?

Environment variables store data that is used by the operating system and other programs. For example, the WINDIR environment variable contains the location of the Windows installation directory. Programs can query the value of this variable to determine where Windows operating system files are located.


1 Answers

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;
}
like image 67
Cheese Lover Avatar answered Oct 30 '22 18:10

Cheese Lover