无操作命令

5 powershell no-op

使用 Bash,您可以使用命令 :

空命令。

没有效果; 命令什么也不做。

退出状态:
总是成功。

例子

Null command.

No effect; the command does nothing.

Exit Status:
Always succeeds.

PowerShell 有类似的东西吗?

小智 4

对于上面的示例,ForEach-Object别名%有效

% 'foo'
Run Code Online (Sandbox Code Playgroud)

或者

function : {}
: 'foo'
Run Code Online (Sandbox Code Playgroud)

或者

[void] 'foo'
Run Code Online (Sandbox Code Playgroud)

PowerShell 数据类型