It's specified on MSDN:
Search for af
on the page, second match:
Directory d, ad
File af
Hidden h, ah
ReadOnly ar
System as
Can also get it via Get-Help dir -full
, see Notes
section, before Example 1
.
Frage
Starting with Powershell v3.0, the following syntax is possible for Get-ChildItem
:
dir -af
Which applies certain attribute selection criteria. By experiment, I found that it means:
dir -File
Which is the same as this:
dir -Attributes !Directory
Is there any official reference on attribute shorthand syntax?
Lösung
It's specified on MSDN:
Search for af
on the page, second match:
Directory d, ad
File af
Hidden h, ah
ReadOnly ar
System as
Can also get it via Get-Help dir -full
, see Notes
section, before Example 1
.
Andere Tipps
I have PowerShell v4 and these Parameter aliases are listed in the built-in help file, this is how I saw them
Help Get-ChildItem -full
Scroll down...
Notes .....
Get-ChildItem Alias Reference:
---------------------------------
Get-ChildItem dir
Directory d, ad
File af
Hidden h, ah
ReadOnly ar
System as
Being aliases, you need to introduce them with the - (minus sign)
Get-ChildItem c:\ -ad -Force
Note 1: I found that 'ad' lists only the directories, whereas 'd' would also list files.
Note 2: I find that -force is useful especially when looking for hidden files or folders.