Getting PID from running bat script

Viewed 3707

Hi i'm trying to find a way to get my own PID from a bat script. I found this:

title=mycmd
tasklist /v /fo csv | findstr /i "mycmd"

that outputs:

"cmd.exe","15084","RDP-Tcp#5","2","2,768 K","Running","MEDIASERVER\Administrator
","0:00:00","Administrator: =mycmd"

how would I get the PID number into a variable in my bat script?

any help would be appreciated.

2 Answers
Related