Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将驱动器号映射到PowerShell中的本地路径?_Powershell - Fatal编程技术网

如何将驱动器号映射到PowerShell中的本地路径?

如何将驱动器号映射到PowerShell中的本地路径?,powershell,Powershell,在PowerShell中,是否可以将驱动器号映射到本地路径 例如,将x:\映射到c:\myfolder1\myfolder2\可以使用: subst x:c:\myfolder1\myfolder2\ 或: New PSDrive-Name x-PSProvider FileSystem-Root c:\myfolder1\myfolder2\ 以下语句也将起作用(并且它仅使用本机powershell cmdlet): 我认为PSDrives只能在PowerShell会话中看到,而不能在外部程序

在PowerShell中,是否可以将驱动器号映射到本地路径

例如,将
x:\
映射到
c:\myfolder1\myfolder2\

可以使用:

subst x:c:\myfolder1\myfolder2\

或:

New PSDrive-Name x-PSProvider FileSystem-Root c:\myfolder1\myfolder2\


以下语句也将起作用(并且它仅使用本机powershell cmdlet):


我认为PSDrives只能在PowerShell会话中看到,而不能在外部程序中看到。@R0MANARMY-这一点很好。如果在PS会话中解决了任何问题,仍然值得展示如何使用。我还注意到同样的情况也适用于
subst
New-PsDrive -Name [DRIVELETTER] -PSProvider filesystem -Root "\\localhost\C$\[PATH]" -Persist