[英]Create a virtual drive with PowerShell
I'm trying to create a D: drive in Windows, which points to some local directory (eg C:\\DDrive) using PowerShell. 我正在尝试在Windows中创建一个D:驱动器,它使用PowerShell指向一些本地目录(例如C:\\ DDrive)。
This code runs fine: 这段代码运行正常:
New-PSDrive -Name D -Root "C:\D_Drive\" -PSProvider "FileSystem"
But in the Windows Explorer no D:-drive is visible. 但在Windows资源管理器中没有D:-drive可见。
How does one use that command correctly? 如何正确使用该命令? Also: the drive should be permanent, so I tried adding a "-Persist" parameter.
另外:驱动器应该是永久性的,所以我尝试添加“-Persist”参数。 But that leads to an error ("unknown parameter "-Persist"...").
但这会导致错误(“未知参数”-Persist“......”)。
The New-PSDrive command only creates a mapping that is visible in PowerShell. New-PSDrive命令仅创建在PowerShell中可见的映射。 It's not shown in explorer at all.
它根本没有在资源管理器中显示。
Here are two other questions that ask the same thing: 以下是另外两个问同样问题的问题:
https://community.spiceworks.com/topic/649234-powershell-mapped-drive-not-showing-in-my-computer https://community.spiceworks.com/topic/649234-powershell-mapped-drive-not-showing-in-my-computer
https://social.technet.microsoft.com/Forums/windowsserver/en-US/96222ba2-90f9-431d-b05a-82b804cdc76e/newpsdrive-does-not-appear-in-explorer?forum=winserverpowershell https://social.technet.microsoft.com/Forums/windowsserver/en-US/96222ba2-90f9-431d-b05a-82b804cdc76e/newpsdrive-does-not-appear-in-explorer?forum=winserverpowershell
Just run: 赶紧跑:
subst D: "C:\D_Drive\"
in non-elevated PS session (don't run as Administrator). 在非提升的PS会话中(不以管理员身份运行)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.