One pseudo environment variable for System32 and Sysnative

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Fla$her
Power Member
Power Member
Posts: 2296
Joined: 2020-01-18, 04:03 UTC

One pseudo environment variable for System32 and Sysnative

Post 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
Overquoting is evil! 👎
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: One pseudo environment variable for System32 and Sysnative

Post 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).
Fla$her
Power Member
Power Member
Posts: 2296
Joined: 2020-01-18, 04:03 UTC

Re: One pseudo environment variable for System32 and Sysnative

Post by *Fla$her »

This is primarily needed for cd in the command line, dir/main menu and buttonbars.
Overquoting is evil! 👎
Post Reply