等效于DIR / X的Get-ChildItem

问题描述 投票:4回答:4

如何在PowerShell中以8.3标记显示目录列表?

windows powershell powershell-3.0
4个回答
6
投票

您可以使用WMI:

Get-ChildItem | ForEach-Object{
    $class  = if($_.PSIsContainer) {"Win32_Directory"} else {"CIM_DataFile"}
    Get-WMIObject $class -Filter "Name = '$($_.FullName -replace '\\','\\')'" | Select-Object -ExpandProperty EightDotThreeFileName
}

3
投票

如果安装PSCX模块,则具有Get-ShortPath cmdlet,可以执行以下操作:


0
投票

您引起我的注意,这不是完整的答案,而是我为您提供帮助的方式:


0
投票

您可以运行cmd ...

© www.soinside.com 2019 - 2024. All rights reserved.