【发布时间】:2019-11-01 05:46:10
【问题描述】:
我很难将子目录嵌套在共享网络驱动器的当前目录中。 我可以创建文件夹
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Windows\system32> new-item
cmdlet New-Item at command pipeline position 1
Supply values for the following parameters:
Path[0]: C:\Temp\Powershell\Date
Path[1]:
Type: directory
Directory: C:\Temp\Powershell
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 06/18/2019 10:31 AM Date
PS C:\Windows\system32> new-item
cmdlet New-Item at command pipeline position 1
Supply values for the following parameters:
Path[0]: U:\gebersole\Documents\New Placements\UI
Path[1]:
New-Item : Cannot find drive. A drive with the name 'U' does not exist.
At line:1 char:9
+ new-item <<<<
+ CategoryInfo : ObjectNotFound: (U:String) [New-Item], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.NewItemCommand
PS C:\Windows\system32>
【问题讨论】:
-
您是否以管理员身份运行会话?听起来类似于this issue
-
可以是UAC related
-
我以管理员身份运行它,但没有运气......
-
看来 PowerShell 会话无法看到您的“U:\”驱动器。一个简单的检查方法是 cd 到该驱动器。如果这不起作用,您可以输入
net use,它应该会列出可用的驱动器。 -
我通过在路径的每一段使用 \\ 解决了这个问题。当我测试路径时它不起作用的原因是它以 New PS U:\> Test-Path U:\gebersole\Documents\'New Placements'\CDENTAL True PS U:\> new-item 结尾
标签: powershell