There are some default PowerShell aliases that shadow built-in (where.exe) or popular 3rd party command line tools (mv.exe, cat.exe, etc. that come with Git). In order to invoke this currently we need to use the command with extension (where.exe) or use the full file path.
It would be easier if PowerShell supported bash-like prefixes to ignore aliases. For example, \where would call C:\Windows\System32\where.exe instead of the Where-Object PowerShell alias.
Would we want to ignore _just_ aliases, or functions and cmdlets too?
@vexx32 I think ignoring functions and cmdlets would be helpful as well.
Would love to see this, although i'm sure the team has many different syntaxes they'd love to see.
Since PowerShell is now many many platforms, it makes sense to support this because overriding cmdlets that don't quite work yet on a platform could give rise to shims as devs need to get things to work, prior to them/somebody else being able to do a pull request here.
For explanation, my use-case is overriding a built-in cmdlet, thus
#in a profile file, etc
PS> set-alias get-builtincmdlet get-replacementbuiltincmdletELS # alias to a new enhanced thing that does something better/more`
function get-replacementbuiltincmdletELS
{
Param($a, $b, $c)
if( $checkSomeHostPropertyOrOtherThingToSeeIfThisDoesntApply )
{
return \get-builtincmdlet @PSBoundParameters # here call the old cmdlet which was fine/better for this case
}
# else do the wonderful new thing
}
@ericleigh007 that's already possible; you can qualify a cmdlet/function name by a module (e.g., Microsoft.PowerShell.Utility\Sort-Object) to accomplish that to whatever degree you need. 馃檪
It also wouldn't be covered by this issue -- @saravanaj specifically mentioned that the target was native utilities and applications rather than PowerShell commands.
Thanks for that reminder.
The way I read it @saravanaj was using the utilities as an example, not constraining the issue. The title is just "disable aliases .. using command prefixes". My interpretation is that the author is looking for a generic, easy way to override the alias translation on a particular string (specifically mentioning "like bash does")
Whichever way you slice it, though, it seems a documentation upgrade to the about_aliases help could show this method of temporarily overriding aliases, as others have asked the question about doing so.
Thanks and sorry for the interruption.
Most helpful comment
Thanks for that reminder.
The way I read it @saravanaj was using the utilities as an example, not constraining the issue. The title is just "disable aliases .. using command prefixes". My interpretation is that the author is looking for a generic, easy way to override the alias translation on a particular string (specifically mentioning "like bash does")
Whichever way you slice it, though, it seems a documentation upgrade to the about_aliases help could show this method of temporarily overriding aliases, as others have asked the question about doing so.
Thanks and sorry for the interruption.