Since I don’t mention what book I’m referring to very often (or ever) I should probably occasionally clarify I’m trying to read through Learn Windows PowerShell in a Month of Lunches 3rd Edition. I’m not just reading it though, I’m completing deconstructing and dissecting it, piece-by-piece. Which is one reason I’m only on chapter 13 after a month of nearly continuous study.
I don’t know yet how this post might end up going. Could be a “stream of consciousness” that just keeps going and going. In other words…settle in. This could be a long one. I’ll try and fix missing words and typos but I think I’ll leave it as however it ends up. It uh gives it character.
As mentioned yesterday I’m trying to use today as a review day. By which I mean I’m re-going over and skimming the information of the first 13 chapters of the book.
One thing I always hear from PS users who don’t bother with things like spending more than a month reading a book on the subject is “PowerShell is really verbose”.
I thought I knew what that meant at one time. I mean on the face of it the meaning of the statement seems obvious: too much typing, too descriptive, no shorthand…the opposite of a language like C. Or “it’s like COBOL” in its verbosity. Whatever.
Well actually it’s not really that verbose. Aliases and positional values can be used to such a point you can hardly even tell what’s going on. I mean if that’s really the way you want the write commands and scripts you can.
It just happens to be “best practice” to write everything out. Write out the parameter names and their values, use the entire name of cmdlets instead of aliases etc. If everything is written out it is effectively “self documenting” for other people to read in the future. Or yourself to read in 18 months for that matter.
For instances Get-Service can be written as gsv and get-member can be gm. So you could write
gsv | gm
If you wanted to. That doesn’t seem “verbose” to me. That seems “really abbreviated” to me. Not sure why it even matters. You can start typing Get-S… and push tab a few times and the shell will write it in anyway. It’s like you have to type the whole thing out or something.
You can also “truncate” parameters. Using -comp for -computername for instance. Just put in enough letters the it’s obvious which parameter you’re trying to refer to and PS will “get the gist” and know what you mean.
So this constant “PowerShell is too verbose” thing I keep hearing will just have to continue to be an annoyance of mine.
Well I didn’t make it as far in as I thought. I think I did accomplish the intended goal of reviewing the information so far. There’s also some things touched upon in early chapter not mentioned again in later chapters. So I’m glad I went back to look at it.