获取 PowerShell 进程的进程 ID [英] get process ID of PowerShell process
问题描述
我如何知道当前 PowerShell 进程的进程 ID (PID)?
How would I know the process ID (PID) of the current PowerShell process?
Copy-Item \\APPSRVR02\DocExport\*.csv \\APPSRVRWPA\d$\DocImport\ImportFiles\
Remove-Item \\APPSRVRAP02\DocExport\*.csv
一些命令来了解正在执行上述语句的进程的 PID.
Some command to know PID of the process that is executing the above statements.
推荐答案
Powershell 有一个概念叫做 自动变量.
Powershell has a concept called Automatic Variables.
这些是主机在启动时定义的变量,所以如果你想知道你正在运行的powershell进程的ID,你可以输入$PID
,它会输出ID您在其中运行的 powershell 进程.取决于您需要的进程 ID 应该适合您.
These are variables which the host defines when it starts up, so if you want to know the ID of the powershell process you are running in you can just type $PID
and it will output the ID of the powershell process you are running within. Depending on what you need the process ID for that should work for you.
这篇关于获取 PowerShell 进程的进程 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!