C:\MyDir\MyFile.txt
New-Item -Name C:\MyDir\MySymLinkFile.txt -ItemType SymbolicLink -Value C:\MyDir\MyFile.txt
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---l 7/30/2018 3:03 PM MySymLinkFile.txt
-a--- 7/30/2018 2:23 PM 12 MyFile.txt
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---l 7/30/2018 3:03 PM MySymLinkFile.txt
d---- 7/30/2018 3:14 PM SubDir
d---l 7/30/2018 3:14 PM SymLinkSubDir
-a--- 7/30/2018 2:23 PM 12 MyFile.txt
C:\Windows\System32\WindowsPowerShell\v1.0
C:\Windows\System32\WindowsPowerShell\v1.0\MyCustom.format.ps1xml
<?xml version="1.0" encoding="utf-8" ?>
<!-- *******************************************************************
Taken from sample files used by the Windows PowerShell engine.
Modified formatting of directory output to include Symlinks and Hardlinks
******************************************************************** -->
<Configuration>
<SelectionSets>
<SelectionSet>
<Name>FileSystemTypes</Name>
<Types>
<TypeName>System.IO.DirectoryInfo</TypeName>
<TypeName>System.IO.FileInfo</TypeName>
</Types>
</SelectionSet>
</SelectionSets>
<!-- ################ VIEW DEFINITIONS ################ -->
<ViewDefinitions>
<View>
<Name>children</Name>
<ViewSelectedBy>
<SelectionSetName>FileSystemTypes</SelectionSetName>
</ViewSelectedBy>
<GroupBy>
<PropertyName>PSParentPath</PropertyName>
<CustomControlName>FileSystemTypes-GroupingFormat</CustomControlName>
</GroupBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>Mode</Label>
<Width>7</Width>
<Alignment>left</Alignment>
</TableColumnHeader>
<TableColumnHeader>
<Label>LastWriteTime</Label>
<Width>25</Width>
<Alignment>right</Alignment>
</TableColumnHeader>
<TableColumnHeader>
<Label>Length</Label>
<Width>14</Width>
<Alignment>right</Alignment>
</TableColumnHeader>
<TableColumnHeader>
<Label>Name</Label>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<Wrap/>
<TableColumnItems>
<TableColumnItem>
<PropertyName>Mode</PropertyName>
</TableColumnItem>
<TableColumnItem>
<ScriptBlock>
[String]::Format("{0,10} {1,8}", $_.LastWriteTime.ToString("d"), $_.LastWriteTime.ToString("t"))
</ScriptBlock>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Length</PropertyName>
</TableColumnItem>
<TableColumnItem>
<ScriptBlock>
If(-not [string]::IsNullOrEmpty($_.Target))
{$_.Name + " --> "+ $_.Target + " (" + $_.LinkType + ")"}
else {$_.Name}
</ScriptBlock>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
</ViewDefinitions>
</Configuration>
Update-FormatData -prependpath C:\Windows\System32\WindowsPowerShell\v1.0\MyCustom.format.ps1xml
C:\Users\<user>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 7/30/2018 3:47 PM SubDir
d----l 7/30/2018 3:48 PM SymLinkSubDir --> C:\MyDir\SubDir\ (SymbolicLink)
-a---- 7/30/2018 3:47 PM 12 Myfile.txt
-a---l 7/30/2018 3:49 PM 0 MySymLinkFile.txt --> C:\MyDir\Myfile.txt (SymbolicLink)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 |