What does the & symbol in powershell mean?

$tool = 'C:\Program Files\gs\gs9.07\bin\gswin64c.exe'


& $tool -q -dNOPAUSE -sDEVICE=tiffg4 $param -r300 $pdf.FullName -c quit

Can someone explain to me how the this works? What exactly does the & symbol do/mean in powershell?

126128 次浏览

&是调用操作符,它允许您执行命令、脚本或函数。
更多细节:
SS64文档: 呼叫接线员(&)
微软文档: 呼叫接线员 &

Syntax
& "[path] command" [arguments]

例如:

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

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

& more
Start-Process "my_script.here"