且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

& 有什么作用?powershell中的符号是什么意思?

更新时间:2022-04-22 02:08:49

& 是调用运算符,它允许您执行命令、脚本或函数.更多详情:&

& is the call operator which allows you to execute a command, a script, or a function. For more details: &

Syntax
      & "[path] command" [arguments]

示例:

$LocalComputerName = & $ENV:windir\System32\HostName.exe

此外,如果您使用 IDE(例如 PowerGUI),您可以在执行辅助进程时阻止它打开一个单独的窗口:

Also, if you use an IDE (such as PowerGUI) you can block it from opening a separate window when executing a secondary process:

& more
Start-Process "my_script.here"