I'm trying to find a way to get my own PID from a command prompt (for later use in bat scripts).
So far the only useful way I found was to use getpids.exe
from here : http://www.scheibli.com/projects/getpids/index.html, but I'm looking for a command that's "built in" to Windows.
I'm looking for a "bullet proof" way. No assumptions about my process being the only cmd.exe or anything.
Best Answer
Since none of the other solutions are bulletproof and built in, I figured I'd offer the following solution, but note that you'll need to parse/save the results somehow: