GetMyPID, Version 1.00 Return or check the parent's (caller's) Process ID Usage: GETMYPID [ pid ] [ /v ] Where: pid is the expected PID to check the actual PID against /V display verbose information on the parent process Notes: With an expected PID specified, this program returns 'errorlevel' 0 if the actual PID matches the expected value, or 2 if not; otherwise, it returns an 'errorlevel' equal to the PID. So to get a batch file's PID, use the following commands: GETMYPID.EXE SET PID=%ErrorLevel% Credits: ParentProcess class by Jared Barneck www.rhyous.com/2010/04/30 /how-to-get-the-parent-process-that-launched-a-c-application/ Written by Rob van der Woude http://www.robvanderwoude.com