The powershell guidelines suggest avoiding the use of aliases in scripts, e.g. spelling out Get-Content
instead of using gc
, and using Foreach-Object
instead of %
.
For the most part I think this is good advice, but I'm having a hard time following it with the dir
alias, at least when used with the filesystem (vs. the registry or such). It seems to me that dir
is as good as or better than Get-ChildItem
, in terms of readability. It's also not nearly as cryptic as something like gc
(Get-Content
) or lp
(Out-Printer
), although maybe someone with no background in cmd.exe scripting might disagree.
Anybody have an opinion on this? Should I keep using dir
, or try to be more 'correct'?