简体   繁体   中英

get process ID of PowerShell process

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

Some command to know PID of the process that is executing the above statements.

Powershell has a concept called Automatic Variables .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM