With Bash, you have the command :
Null command. No effect; the command does nothing. Exit Status: Always succeeds.
Example
: 'foo'
Does PowerShell have something similar to this?
With Bash, you have the command :
Null command. No effect; the command does nothing. Exit Status: Always succeeds.
Example
: 'foo'
Does PowerShell have something similar to this?
With the above example, the ForEach-Object
alias %
works
% 'foo'
Or
function : {}
: 'foo'
Or
[void] 'foo'
Another even shorter solution is to use the alias of Where-Object
which is ?
.
This command line does nothing (and succeeds):
? .
The trick is simply to pass a single-character argument so that the command does not fail and which has no special meaning in powershell.