我需要在Powershell中知道当前驱动器是否为映射驱动器。
不幸的是,Get-PSDrive并没有像预期的那样工作:
PS:24 H:\temp
>get-psdrive h
Name Provider Root CurrentLocation
---- -------- ---- ---------------
H FileSystem H:\ temp
但在 MS-Dos 中,“net use” 显示 H: 真的是一个映射到网络驱动器上的驱动器:
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
OK H: \\spma1fp1\JARAVJ$ Microsoft Windows Network
The command completed successfully.
我想要做的是获取驱动器的根目录并在提示符中显示它(参见:自定义PowerShell提示符 - 相当于CMD的$M$P$_$+$G?)