Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > Process ids

Reply
 
 
Steve Rainbird
Guest
Posts: n/a

 
      12-18-2008
Is it possible to get the process id of a program that you have just run in
a bat file?

--
Steve

 
Reply With Quote
 
 
 
 
Chirag
Guest
Posts: n/a

 
      12-19-2008
If only one instance of that program is running, the following bat file
could prove useful to you to determine the PID of that process:

---
@echo off
set PID=
for /F "tokens=2 delims=," %%A in ('tasklist /nh /fo csv /fi "imagename eq
notepad.exe"') do set PID=%%A
echo pid=%PID%
---

Note that "for...do set PID=%%A" is in the same line (the post may
wrap-around). Replace notepad.exe with the executable name of the program
for which you want to find the process id.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html

"Steve Rainbird" <> wrote in message
news:...
> Is it possible to get the process id of a program that you have just run
> in a bat file?
>
> --
> Steve


 
Reply With Quote
 
Steve Rainbird
Guest
Posts: n/a

 
      12-19-2008


"Chirag" <> wrote in message
news:393DE370-70F0-4D0A-948E-...
> If only one instance of that program is running, the following bat file
> could prove useful to you to determine the PID of that process:
>
> ---
> @echo off
> set PID=
> for /F "tokens=2 delims=," %%A in ('tasklist /nh /fo csv /fi "imagename eq
> notepad.exe"') do set PID=%%A
> echo pid=%PID%
> ---
>
> Note that "for...do set PID=%%A" is in the same line (the post may
> wrap-around). Replace notepad.exe with the executable name of the program
> for which you want to find the process id.
>
> - Chirag
>
> PowerShow - View multiple PowerPoint slide shows simultaneously
> http://officeone.mvps.org/powershow/powershow.html
>
> "Steve Rainbird" <> wrote in
> message news:...
>> Is it possible to get the process id of a program that you have just run
>> in a bat file?
>>
>> --
>> Steve

>


Chirag,

Thanks for that but the reason I want to know the pid is that there may be
many running.

I want the program to create a print file which contains its pid so that the
script can then print that file after it has finished.

--
Steve

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista Can't End Process Shawn H Windows Vista Performance 2 12-31-2007 04:06 AM
TrustedInstaller.exe process Piotr Wozniacki Windows Vista Installation 1 09-21-2007 09:20 AM
Process dwm.exe rarno Windows Vista Installation 0 06-23-2006 01:37 PM
Process dwm.exe rarno Windows Vista Installation 0 06-23-2006 01:36 PM
Process dwm.exe rarno Windows Vista Installation 0 06-23-2006 01:35 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59