question: get-alias can get the alias of any command, but i dont know how to use get-alias to search parameter alias. Like get-command -name > gcm -na. how can i find they
Why did you ask the question twice? Please delete the question with the category Website & Forum Feedback
.
Thanks in advance.
You can’t. Get-Alias
only lists aliasses for cmdlets or commands in your current session.
Have you tried to search for an answer? It took me about 20 seconds gooling for powershell "get-help" alias for parameter
finding this:
BTW: Using aliasses in scripts - especially when you show them to other people - are considered bad style and make your code harder to read, harder to understand and therefor harder to maintain. And since you can use tab completion to expand cmdlet names or parameter names it saves hardly that much time you may think.
thank u very much, but I see your link seems like make a function to search parameter alias
I have google the question “powershell search parameter alias”, and didnt get any valid information . and I am new to powershell for just one day, so i dont know where can i find the answer i want
In fact, i am read a book for learning powershell, and “find the parameter alias” is a practice question after introduce the help system, i think it maybe dont need to make a function
And what’s the issue with that? Isn’t that what you’ve asked for?
Your initial question I already answered:
If you don’t like the function you don’t have to use it. Use just the lines of code you need for your particular needs instead.
I have google the question “powershell search parameter alias”, and didnt get any valid information
Really? If I search Google for exactly this, the link I posted above is among the first 3 hits.
I am new to powershell for just one day
Where should we know this? You did not introduce yourself.
so i dont know where can i find the answer i want
Hmmm … what do you mean with that? You Google it! … or Bing or whatever search eingine you prefer … … and if you did not find satisfying answers with your first search atempt you change the search string and continue searching … In the vast majority of the cases you’re not the very first one with a given task. It is very likely that someone else already solved the issue you’re looking for a solution for and shared the solution with the world.
In fact, i am read a book for learning powershell
So either it’s a really bad book putting the focus on that topic for beginners or you have got something wrong. Yes - there are aliasses for cmdlets and functions and for a lot of parameters as well, but there are way more important features and concepts you should learn as a beginner before you focus on aliasses.
Again … aliasses are fine in interactive sessions in the console but are considered bad style in scripts and you should actually avoid using them.
and “find the parameter alias” is a practice question after introduce the help system
May I ask what book that is you’re reading? That sound’s like a weird task for beginners.