如何获取 64 位的 pshome 路径? [英] How to get the pshome path for 64-bits?
问题描述
可以使用 $PSHome
变量 (c:\Windows\System32\WindowsPowerShell\v1.0\
) 访问 32 位主文件夹的路径.
The path to home folder in 32-bits is accessible using the $PSHome
variable (c:\Windows\System32\WindowsPowerShell\v1.0\
).
如何访问包含 64 位版本路径的变量 (c:\Windows\SysWOW64\WindowsPowerShell\v1.0\
)?
How to access the variable that contains the path to the 64-bits version (c:\Windows\SysWOW64\WindowsPowerShell\v1.0\
) ?
编辑
正如 Jeff Zeitlin 在标记为正确的答案中解释的那样,这个问题是无效的...
As Jeff Zeitlin explained in the answer marked as correct, this question is invalid...
推荐答案
你已经倒退了 - 在 64 位 Windows 上,C:\WINDOWS\SYSTEM32
是针对 64 位的;C:\WINDOWS\SYSWOW64
用于 32 位的东西.这是因为微软为了向后兼容,选择制作主"目录SYSTEM32
;新的 32 位文件夹名为 SYSWOW64
,作为Windows-on-Windows64 系统"的简写.
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".
但是,要回答您的实际问题:如果您运行的是 64 位 PowerShell,$PSHome
指向 64 位主文件夹,C:\WINDOWS\System32\WindowsPowerShell\v1.0\
;如果您运行的是 32 位 PowerShell(Windows Powershell (x86)"),$PSHome
将指向 C:\WINDOWS\SYSWOW64\WindowsPowerShell\v1.0\
.我不确定是否有办法获得 $PSHome-for-the-other-bittedness
的等效项.
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
.
这篇关于如何获取 64 位的 pshome 路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!