Windows PowerShell 驱动器是一个数据存储位置,你可以像访问 Windows PowerShell 中的文件系统驱动器那样访问它。 Windows PowerShell 提供程序将为你创建一些驱动器,例如文件系统驱动器(包括 C: 和 D:)、注册表驱动器(HKCU: 和 HKLM:)和证书驱动器 (Cert:),你也可以创建自己的 Windows PowerShell 驱动器。 这些驱动器非常有用,但它们仅在 Windows PowerShell 内可用。 你无法通过使用其他 Windows 工具(如文件资源管理器或 Cmd.exe)访问它们。
Windows PowerShell 可针对适用于 Windows PowerShell 驱动器的命令使用名词 PSDrive。 有关 Windows PowerShell 会话中的 Windows PowerShell 驱动器列表,请使用 Get-PSDrive cmdlet。

PS C:\Users\maxsu> Get-PSDrive

Name           Used (GB)     Free (GB) Provider      Root                                               CurrentLocation
----           ---------     --------- --------      ----                                               ---------------
Alias                                  Alias
C                  75.69        384.75 FileSystem    C:\                                                    Users\maxsu
Cert                                   Certificate   \
E                  73.53         73.60 FileSystem    E:\
Env                                    Environment
F                  63.17         83.31 FileSystem    F:\
Function                               Function
G                  82.65         82.39 FileSystem    G:\
HKCU                                   Registry      HKEY_CURRENT_USER
HKLM                                   Registry      HKEY_LOCAL_MACHINE
Variable                               Variable
WSMan                                  WSMan

尽管显示内容中的驱动器与你的系统上的驱动器有所不同,但是该列表将看起来类似于 Get-PSDrive 命令的输出(如上所示)。
文件系统驱动器是 Windows PowerShell 驱动器的子集。 你可以通过 Provider 列中的 FileSystem 条目标识文件系统驱动器。 (Windows PowerShell 中的文件系统驱动器受 Windows PowerShell FileSystem 提供程序支持。)
若要查看 Get-PSDrive cmdlet 的语法,请使用 Syntax 参数键入 Get-Command 命令:

PS C:\Users\maxsu> Get-Command -Name Get-PSDrive -Syntax

Get-PSDrive [[-Name] <string[]>] [-Scope <string>] [-PSProvider <string[]>] [-UseTransaction] [<CommonParameters>]

Get-PSDrive [-LiteralName] <string[]> [-Scope <string>] [-PSProvider <string[]>] [-UseTransaction] [<CommonParameters>]

PSProvider 参数允许你仅显示受特定提供程序支持的 Windows PowerShell 驱动器。 例如,若要仅显示受 Windows PowerShell FileSystem 提供程序支持的 Windows PowerShell 驱动器,请使用 PSProvider 参数和 FileSystem 值键入 Get-PSDrive 命令:

PS C:\Users\maxsu> Get-PSDrive -PSProvider FileSystem

Name           Used (GB)     Free (GB) Provider      Root                                                                                       CurrentLocation
----           ---------     --------- --------      ----                                                                                       ---------------
C                  75.69        384.75 FileSystem    C:\                                                                                            Users\maxsu
E                  73.53         73.60 FileSystem    E:\
F                  63.17         83.31 FileSystem    F:\
G                  82.65         82.39 FileSystem    G:\

若要查看表示注册表配置单元的 Windows PowerShell 驱动器,请使用 PSProvider 参数来仅显示受 Windows PowerShell Registry 提供程序支持的 Windows PowerShell 驱动器:

PS C:\Users\maxsu> Get-PSDrive -PSProvider Registry

Name           Used (GB)     Free (GB) Provider      Root                                                                                       CurrentLocation
----           ---------     --------- --------      ----                                                                                       ---------------
HKCU                                   Registry      HKEY_CURRENT_USER
HKLM                                   Registry      HKEY_LOCAL_MACHINE

还可以将标准 Location cmdlet 与 Windows PowerShell 驱动器结合使用:

PS> Set-Location HKLM:\SOFTWARE
PS> Push-Location .\Microsoft
PS> Get-Location

Path
----
HKLM:\SOFTWARE\Microsoft