3 ms·
Aliases in PowerShell only alias the command itself and can not supply any parameters or other processing. This makes certain things nice, in that Get-Help work
by ygra 10y ago
Aliases in PowerShell only alias the command itself and can not supply any parameters or other processing. This makes certain things nice, in that Get-Help works straightforward with aliases, and tab completion for arguments as well, but it complicates the case where you want to supply default arguments or do other things. You can run Get-Content Function:help to see how it can be done. Essentially it consists of:
- Writing a function
- Redirecting to the correct help topic
- Replicating all parameters and parameter sets so that tab completion works
Of course, if help and completion are irrelevant to you (wouldn't work correctly out of the box for bash either, I guess), then it just consists of writing a wrapper function instead of setting an alias.