Page 1 of 1

One pseudo environment variable for System32 and Sysnative

Posted: 2022-07-06, 21:15 UTC
by Fla$her
$System currently returns %SystemRoot%\System32 on both TC x64 and TC x32.
As a result, on Win x64 we see a different number of objects.
It would be useful and correct for the new variable to return %SystemRoot%\Sysnative for TC x32 and %SystemRoot%\System32 for TC x64.

So far, I'm implementing this via autorun.cfg:

Code: Select all

If %AUTORUN_OSARCH% = 64 And %AUTORUN_TCARCH% = 32 Then
  SetEnv SYSTEM32 '%SystemRoot%\Sysnative'
Else
  SetEnv SYSTEM32 '%SystemRoot%\System32'
EndIf

Re: One pseudo environment variable for System32 and Sysnative

Posted: 2022-07-10, 18:01 UTC
by MVV
Unfortunately such path can't be passed to an external app because it may have mismatching architecture. It was very dumb for MS to make Sysnative folder only accessible for 32-bit applications so there is no universal way to refer to 64-bit System32 folder (it was very dumb to invent redirection at all though).

Re: One pseudo environment variable for System32 and Sysnative

Posted: 2022-07-11, 15:46 UTC
by Fla$her
This is primarily needed for cd in the command line, dir/main menu and buttonbars.