在DOS或Powershell中获取网络共享的物理路径

Bob*_*way 2 directory powershell dos

简单的问题,但我似乎无法找到或找出答案.

我有一个变量,表示Windows网络共享,例如

\\myBoxName\networkshare\shared
Run Code Online (Sandbox Code Playgroud)

在DOS或PowerShell中(最好是前者,虽然这不是什么大问题)我需要获得另一个变量值来指示该网络共享的物理路径.所以我正在寻找的答案是......

D:\Networkshare\shared
Run Code Online (Sandbox Code Playgroud)

该脚本在共享所在的框上运行,如果有帮助的话.

干杯,马特

CB.*_*CB. 6

试试这个:

(Get-WmiObject Win32_Share -filter "Name LIKE 'shared'").path # return the path of the share named 'shared"
Run Code Online (Sandbox Code Playgroud)