3 ms·
I also like that a system touted for comprehensibility and discoverability has the following very commonly used command: Get-ChildItem Guess what it does
by romwell 10y ago
I also like that a system touted for comprehensibility and discoverability has the following very commonly used command:
Get-ChildItem
Guess what it does by looking at its name.
Correct, it lists the contents of a directory! What else could it be? Conversely, if you want to find out what "dir"/"ls" would be in PowerShell, where else would you be looking!
I like the idea of PowerShell a lot (object-oriented piping), but I hope it evolves into something with saner default aliases and better documentation, with easy things accomplished easily.
- RandomOpinion 10y agoFrom a basic data structures class in college, one might recall that nodes in a tree have can have child nodes. Filesystems, most of them anyway, are structured as trees of files and directories. Therefore one would expect a command named "Get-ChildItem" executed against the current directory to do...? (Aside from that, the Powershell default alias set translates both "dir" and "ls" to Get-ChildItem.)
- yomritoyj 10y agoGet-ChildItem also works on things other than directories. And Powershell understands both ls and dir!
- throwaway7645 10y agoIt knows ls, but there are a lot of UNIX commands it doesn't and it isn't a true implementation, but an alias for running Get-Childitem.
- ygra 10y agoYes, the point is to get started easily if you're used to another environment, not to be able to use it as a cmd or bash replacement.
- detaro 10y agoConversely, if you want to find out what "dir"/"ls" would be in PowerShell, where else would you be looking Not so hopeless (although if you ask for detailed docs it opens a browser for you,internet required): PS C:\Users\xxx> help ls NAME Get-ChildItem SYNTAX Get-ChildItem [[-Path] <string[]>] [[-Filter] <string>] [<CommonParameters>] Get-ChildItem [[-Filter] <string>] [<CommonParameters>] ALIASES gci ls dir
- noinsight 10y ago> Correct, it lists the contents of a directory It does so much more than that. It can display child items from any PSProvider (Get-PSProvider): defined aliases, environmental variables, defined variables, defined functions, registry nodes, X.509 certificate containers and even Active Directory paths. "FileSystem" is just one provider amongst many. You can also `cd` to any of these providers to use them in a filesystem-like manner. e.g. `cd HKLM:\`, `cd AD:\` (if you have the ActiveDirectory module) That's why the name is abstract. Many of the default cmdlets work on all kinds of stuff, not just bare filesystem stuff.