View Single Post
Old 07-23-2009, 09:51 AM  
WiredGuy
Pounding Googlebot
 
Industry Role:
Join Date: Aug 2002
Location: Canada
Posts: 34,461
SysAdmin's, How to Get Process ID on Windows?

I'm converting a linux shell script into a Windows batch file and I'm having a hard time figuring out how to return the process ID of a program I just launched. I run this program in an infinite loop in the batch script so I need to get the process ID right after I launch it to keep track of which pid is with which session (so dumping tasklist won't work).

Unix Example:
java -jar Keywords.jar &
echo $!

On Linux $! is the pid. This is being launched from a batch file so how can I capture the pid on a Windows environment right after I launch?
WG
__________________
I play with Google.

Last edited by WiredGuy; 07-23-2009 at 09:52 AM..
WiredGuy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote