set an alias for a command ( or function ) and specify parameters?

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 3 years, 8 months ago.

  • Author
    Posts
  • #10716
    Profile photo of Ian Douglas
    Ian Douglas
    Participant

    Is it possible to set an alias for a command ( or function ) and specify parameters? For a simplified example —

    # define alias
    set-alias -name show-members -value "Get-QADGroupMember -Identity $args"

    # usage example
    show-members

    (I'm trying to do this with some custom functions I have given to users. )

    Many thanks!

  • #10719
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Not an alias, no. Aliases are only nicknames for commands.

    That said, there's nothing stopping you from defining a function that runs a command and uses specific parameters. That's what "help" is.

You must be logged in to reply to this topic.