Identify the PID of a Executing Batch File in Powershell
问题 I need to identify the P(rocess) ID of an executing batch file from a PowerShell (v1.0) script. Can anyone suggest a way of doing this? Thanks, MagicAndi. 回答1: Well, whether that's possible depends on how you executed the batch file. In general, the only way you could possibly find this out is to look at the command line used to start the batch. If you double-click a batch file in Windows Explorer you'll get a command line like cmd /c ""C:\Users\Me\test.cmd" " In Powershell you can then use