4

I've used SysNative before to access the 64 bit system32 directory, but I don't seem to be able to find an equivalent for the Program Files directory. I feel like I'm missing something simple, but if I try to do something such as:

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

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

Could anyone point me at the proper way of accessing the 64 bit program files (from 32 bit powershell)?

Kyle
  • 17,317
  • 32
  • 140
  • 246

2 Answers2

8

Could be a lot shorter :)

$env:ProgramW6432
Shay Levy
  • 121,444
  • 32
  • 184
  • 206
0

Figured it out!

$programFiles = [System.Environment]::GetEnvironmentVariable("ProgramW6432")
Kyle
  • 17,317
  • 32
  • 140
  • 246