最近搭建emby
需要挂在网络驱动器,但是用的精简版的win10,没办法通过系统的工具挂载(被阉割了),所以想到用powershell
实现
shell# adjust path to point to your file share
$UNCPath = '\\server\share'
#方法一
net use * $UNCPath
#方法二
New-PSDrive -Name y -PSProvider FileSystem -Root $UNCPath -Persist
#方法三
New-SmbMapping -LocalPath 'x:' -RemotePath $UNCPath
Net.exe 是最多功能的方法,在 PowerShell 的所有版本中都有效。通过传入一个 “*”,它自动选择下一个有效的驱动器盘符。
New-PSDrive 从 PowerShell 3 起支持 SMB 共享。
New-SmbMapping 需要 SmbShare 模块并且现在看来有点古怪:重启后才能在 Windows Explorer 中显示该驱动器。
本文作者:mereith
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!