获取 PowerShell 进程的进程 ID [英] get process ID of PowerShell process

查看:88
本文介绍了获取 PowerShell 进程的进程 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何知道当前 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆