我想在PowerShell中写出当前进程ID。此作品:在PowerShell中连接字符串和表达式结果
$processId = $([System.Diagnostics.Process]::GetCurrentProcess()).Id
Write-Output "My process ID is $processId"
但是,如果可能,我想在一行中完成。用$([System.Diagnostics.Process]::GetCurrentProcess()).Id
代替变量似乎没有评估表达式。
啊,谢谢你,那是有效的! – EMP 2011-01-19 23:30:29