Forum Discussion
Looking for insight #1
Using PS 5.1
Still a PowerShell newb.
I have been trying to use the PowerShell documentation to answer my questions. Some success, many failures.
One such failure was figuring out what "-EA 0" meant to the remove-variable cmdlet. There was nothing under the official(???) PowerShell documentation remove-variable in 7.2 or 5.1. I found get-alias, but EA was not mentioned in the output. (I found the meaning in a entry at the Microsoft devblogs).
What I would like to know is if there is a secret decoder ring for finding out these "officially undocumented" entries? Something other than "do an internet search".
Thanks.
- LainRobertsonSilver Contributor
Discovering some of these things is simply a case of pot luck - unless you're willing to sit down and progressively read the documentation on docs.microsoft.com.
Most of the "interesting" articles are the ones from the online help, but a bit easier to navigate since it's all laid out for you, ala the one about common parameters (for which EA is shorthand for the ErrorAction common parameter.)
Although you've already found the answer, "-EA 0" translates to "-ErrorAction:SilentlyContinue".
I personally have beef with rampant shorthand unless you're doing basic ad hoc work from the command line that nobody else will ever read.
I feel that anything longer-lasting should be self-evident and self-documenting, but then I'm also an old geezer, so your mileage with others will vary.
Cheers,
Lain
- LainRobertsonSilver Contributor
Actually, it's crude, but you can actually dynamically pull a list of parameters and any aliases defined for them:
Get-Command -Name "Remove-Variable" | ForEach-Object { $_.Parameters.GetEnumerator() | ForEach-Object { $_.Value }| Select-Object -Property Name, Aliases }
You'd just change the name of the commandlet to whatever it is you're keen to look up the parameters for.
Cheers,
Lain
- MNtobarCopper Contributor
Thanks for the "crude". I don't suppose there is an alias for it??? ;-). :-P(I guess I could create my own.)
Being "old geezer" myself I agree. I find it slightly amusing that they created this very verbose language, which is great for self-documenting, but then got tired of all the typing so made alias a possibility. I am still on the "why is this so complicated" side of the learning curve, but I kind of get it. I am not good at typing, so I will never be a fan of PowerShell purity. I long for my days of UNIX. "cd, cat, ls, yacc, awk, …". (And I get the irony of how confusing things can be when you don't know what they mean. 🙂