如何在不显示当前目录的情况下显示文件和文件夹名称以及终端图标?
How to show file and folder names along with terminal icons without showing current directory?
我想删除space/区域显示
Directory: C:\Users\varun\Desktop\Projects\advanced-react-patterns-v2
当我 运行 命令时:
Get-ChildItem | Format-Wide
其他详细信息:
- 使用 Windows 终端和 Powershell
- 截图中使用的字体:TerminessTTF NF
- 二手Terminal-Icons
注意:命令
Get-ChildItem -Name
未能显示终端图标是我的主要目标。
当您使用 Format-*
命令时,您使用的是文件和目录对象的默认格式化输出,它按目录对文件进行分组 - 因此目录名称位于顶部。
如果您想绕过这个,您必须编写自己的 format.ps1xml 文件,然后将格式添加到您的输出中。
$files = Get-ChildItem
foreach ($file in $files) {
$file.PSObject.TypeNames.Insert(0,'Custom.Output.Type')
$file
}
指定Typename的XML小样本,自定义即可。
<View>
<Name>CustomFileFormatting</Name>
<ViewSelectedBy>
<TypeName>Custom.Output.Type</TypeName>
</ViewSelectedBy>
<TableControl>
<AutoSize />
<TableHeaders>
<TableColumnHeader>
<Label>FullName</Label>
<Alignment>Left</Alignment>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>FSObject</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
我想删除space/区域显示
Directory: C:\Users\varun\Desktop\Projects\advanced-react-patterns-v2
当我 运行 命令时:
Get-ChildItem | Format-Wide
其他详细信息:
- 使用 Windows 终端和 Powershell
- 截图中使用的字体:TerminessTTF NF
- 二手Terminal-Icons
注意:命令
Get-ChildItem -Name
未能显示终端图标是我的主要目标。
当您使用 Format-*
命令时,您使用的是文件和目录对象的默认格式化输出,它按目录对文件进行分组 - 因此目录名称位于顶部。
如果您想绕过这个,您必须编写自己的 format.ps1xml 文件,然后将格式添加到您的输出中。
$files = Get-ChildItem
foreach ($file in $files) {
$file.PSObject.TypeNames.Insert(0,'Custom.Output.Type')
$file
}
指定Typename的XML小样本,自定义即可。
<View>
<Name>CustomFileFormatting</Name>
<ViewSelectedBy>
<TypeName>Custom.Output.Type</TypeName>
</ViewSelectedBy>
<TableControl>
<AutoSize />
<TableHeaders>
<TableColumnHeader>
<Label>FullName</Label>
<Alignment>Left</Alignment>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>FSObject</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>