I want to remove the space/ area taken up in showing the
Directory: C:\Users\varun\Desktop\Projects\advanced-react-patterns-v2
when I run the command:
Get-ChildItem | Format-Wide
Additional details:
Note: The command
Get-ChildItem -Name
failed to show the terminal icons which kind of my main goal here.
When you are using a Format-*
command you are using the default formatting output for the File and Directory objects, which groups files by directory - hence the directory name at the top.
If you wanted to by pass this, you would have to write your own format.ps1xml file and then add the formatting to your output.
$files = Get-ChildItem
foreach ($file in $files) {
$file.PSObject.TypeNames.Insert(0,'Custom.Output.Type')
$file
}
Small sample of XML for the specified Typename, customise as you wish.
<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>