我想列出C:驱动器的文件。首先,我想从逻辑磁盘wmi对象中获取设备ID,并列出它。流水线输入/输出
以下命令返回:
Get-WmiObject -class Win32_logicaldisk
DeviceID : C:
DriveType : 3
ProviderName :
FreeSpace : 940371968
Size : 125809192960
VolumeName :
但这个命令:
Get-WmiObject -class Win32_logicaldisk | select deviceid | Get-ChildItem -path {$_}
,给出以下错误:
Get-ChildItem : Cannot find drive. A drive with the name '@{deviceid=C' does not exist. At line:1 char:60
+ Get-WmiObject -class Win32_logicaldisk | select deviceid | Get-ChildItem -path { ...
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (@{deviceid=C:String) [Get-ChildItem], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
GET-ChildItem -path的管道输入,怎么样 我们能解决这个问题?