Reputation: 1472
The path to home folder in 32-bits is accessible using the $PSHome
variable (c:\Windows\System32\WindowsPowerShell\v1.0\
).
How to access the variable that contains the path to the 64-bits version (c:\Windows\SysWOW64\WindowsPowerShell\v1.0\
) ?
EDIT
As Jeff Zeitlin explained in the answer marked as correct, this question is invalid...
Upvotes: 5
Views: 12177
Reputation: 17161
That changes depending on whether you're running the 32-bit or 64-bit version of PowerShell!
C:\Windows\SysWOW64\WindowsPowerShell\v1.0
C:\Windows\System32\WindowsPowerShell\v1.0
Use this code to identify whether you're running in 64-bit mode or not!
[Environment]::Is64BitProcess
Upvotes: 3
Reputation: 10799
You've got it backwards - on 64-bit Windows, C:\WINDOWS\SYSTEM32
is for 64-bit stuff; C:\WINDOWS\SYSWOW64
is for 32-bit stuff. This is because Microsoft chose to make the "main" directory SYSTEM32
for backward compatibility; the new 32-bit folder is called SYSWOW64
as shorthand for "System for Windows-on-Windows64".
However, to answer your actual question: If you are running 64-bit PowerShell, $PSHome
points to the 64-bit home folder, C:\WINDOWS\System32\WindowsPowerShell\v1.0\
; if you are running 32-bit PowerShell ("Windows Powershell (x86)"), $PSHome
will point to C:\WINDOWS\SYSWOW64\WindowsPowerShell\v1.0\
. I'm not sure if there is a way to get the equivalent of $PSHome-for-the-other-bittedness
.
Upvotes: 11