![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Process ids Is it possible to get the process id of a program that you have just run in a bat file? -- Steve |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Process ids 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" <steve.nospam.rainbird@xxxxxx> wrote in message news:6r0527Ff35j5U1@xxxxxx Quote: > Is it possible to get the process id of a program that you have just run > in a bat file? > > -- > Steve |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Process ids "Chirag" <Chirag@xxxxxx> wrote in message news:393DE370-70F0-4D0A-948E-E462A91360E6@xxxxxx Quote: > 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" <steve.nospam.rainbird@xxxxxx> wrote in > message news:6r0527Ff35j5U1@xxxxxx Quote: >> Is it possible to get the process id of a program that you have just run >> in a bat file? >> >> -- >> Steve 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 |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Failover Guest Cluster -- 'The process cannot access the file becauseit is being used by another process.' | Virtual Server | |||
| Process count wrong when only one process matches criteria | PowerShell | |||
| get-process & stop-process by owner | PowerShell | |||
| Process dwm.exe | Vista installation & setup | |||
| Bug? Shouldn't Stop-Process automatically match Id if object is a process? | PowerShell | |||