Power Shell in x86 process - access to 64-bit program files

I used SysNative before accessing the 64-bit system32 directory, but I seem to be unable to find the equivalent for the program files directory. I feel like I'm missing something simple, but if I try to do something like:

$command = "${Env:ProgramFiles}\Company\executable.exe" 

Then $command ends with C: \ Program Files (x86) \ Company \ executable.exe.

Can someone tell me the correct way to access 64-bit program files (from a 32-bit command line)?

+4
source share
2 answers

Could be much shorter :)

 $env:ProgramW6432 
+8
source

It revealed!

 $programFiles = [System.Environment]::GetEnvironmentVariable("ProgramW6432") 
0
source

Source: https://habr.com/ru/post/1436865/


All Articles