Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Process ID

Status
Not open for further replies.

bullrider

Programmer
Joined
Sep 14, 2001
Messages
6
Location
US
Can anyone tell me how to obtain the process ID for the batch file I am running? I would like to append the process ID to file titles and messages.

Thank you.
 
While the bat file is running, you can go into TASK MANAGER and see the process ID.

To do this:

1) Launch BAT file
2) Launch Task MAnager (CTRL-ALT-DEL --> Task MAnanger)
3) Click the Proccesses tab
4) Look for you bat file...(it should be listed) PID column = Process ID.


Or you can use TLIST (Resource kit util from a command line)

Hope this helps. Joseph L. Poandl
MCSE 2000


 
Thanks for replying. I'm looking to obtain the process id within the batch. I want to set a variable in the batch file to the process id. In UNIX it's a snap: jobid=$$ This is proving to be a problem in NT.
 
I'm too sure. You may want to get the NT Resource Utility and investigate TLIST (Task List).

Here's what it can do:

TLIST <<-m <pattern>> | <-t> | <pid> | <pattern> | <-p <processname>>>
[options]:
-t
Print Task Tree

<pid>
List module information for this task.

<pattern>
The pattern can be a complete task
name or a regular expression pattern
to use as a match. Tlist matches the
supplied pattern against the task names
and the window titles.

-m <pattern>
Lists all tasks that have DLL modules loaded
in them that match the given pattern name

-s
Show services active in each process.

-p <processname>
Returns the PID of the process specified or -1
if the specified process doesn't exist. If there
are multiple instances of the process running only
the instance with the first PID value is returned.


Hope this helps... Joseph L. Poandl
MCSE 2000


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top