27 Mar 2017 superuser   » (Journeyer)

PowerShell for Bash Users

Working with Objects

PowerShell works with objects rather than plain text.  While this might seem odd, it’s also pretty powerful.  So, if you run the ls command, it will return a bunch of objects that have fields (Members).  You can figure out what this is easily by running ls | get-member.

PS C:\Users\jason_000> ls | get-member
...
Name Property string Name {get;}
Parent Property System.IO.DirectoryInfo Parent {get;}
Root Property System.IO.DirectoryInfo Root {get;}
BaseName ScriptProperty System.Object BaseName {get=$this.Name;}
...

So, I’ve cut out a lot of information, because you get a lot of members you can work with, but you get the idea.  But what this means is if you just want all the names, you can run (ls).name.  That will return a list of just the name members of the objects that would get returned normally.

History

Get-History is history.

Last Command

$$

Syndicated 2017-03-27 04:03:54 from JasonLotito

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!