Here's a batch file that *might* also help?  It makes use of both handle.exe 
and taskkill.exe to hopefully achieve what you're looking for?

      :: Forcefully kills the process with the given open file containing the
      :: specified pattern.  For example, running the following will kill the 
first
      :: process found with a file open that contains the string 
"wireshark_pcapng"
      :: anywhere in the name:
      ::
      ::     killprocbyfile.bat wireshark_pcapng
      ::

      @ECHO OFF

      IF ["%~1"] == [""] GOTO USAGE

      @ECHO OFF
      FOR /F "TOKENS=1-3 USEBACKQ" %%I IN (`HANDLE.EXE "%1"`) DO (
          IF "%%J" == "pid:" (
              ECHO Killing %%I PID: %%K
              TASKKILL.EXE /F /PID %%K
              GOTO :EOF
          )
      )
      GOTO :EOF

      :USAGE
      ECHO Usage: %~0 ^<pattern^>

- Chris

> -----Original Message-----
> From: [email protected] [mailto:wireshark-dev-
> [email protected]] On Behalf Of Maynard, Chris
> Sent: Monday, April 10, 2017 2:12 PM
> To: Developer support list for Wireshark <[email protected]>
> Subject: Re: [Wireshark-dev] buildbot down?
>
> Would taskkill.exe help?
>
> For example, "taskkill.exe /im dumpcap.exe" , etc.
>
> I've also used WMIC in the past to save ProcessID's of tasks so you can later 
> kill
> specific instances of a task instead of all of them with the same name.  I'd 
> refer
> you to the dumpcap.bat file posted on https://wiki.wireshark.org/Tools for how
> I did that.
>
> - Chris
> [1]:
> https://www.microsoft.com/resources/documentation/windows/xp/all/proddoc<https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/taskkill.mspx?mfr=true>
> s/en-us/taskkill.mspx?mfr=true
>
> - Chris
>
> > -----Original Message-----
> > From: 
> > [email protected]<mailto:[email protected]>
> >  [mailto:wireshark-dev-
> > [email protected]<mailto:[email protected]>] On Behalf Of Gerald 
> > Combs
> > Sent: Monday, April 10, 2017 2:06 PM
> > To: Developer support list for Wireshark 
> > <[email protected]<mailto:[email protected]>>
> > Subject: Re: [Wireshark-dev] buildbot down?
> >
> > On 4/9/17 1:23 AM, Graham Bloice wrote:
> > >
> > >
> > > On 9 April 2017 at 01:54, Gerald Combs <[email protected]
> > > <mailto:[email protected]>> wrote:
> > >
> > >     On 4/8/17 10:47 AM, Peter Wu wrote:
> > >     >
> > >     > There is another problem though with the Petri-Dish builder, a 
> > > previous
> > >     > build on the Petri-Dish Windows x86 builder failed and left a 
> > > process on
> > >     > the machine, breaking all following builds. Gerald, can you have a 
> > > look?
> > >
> > >     It's back up.
> > >
> > >     > Maybe it is an idea to add a pass that kills all
> > >     > dumpcap/tshark/wireshark processes before starting the build?
> > (Assuming
> > >     > that no other builds happen in parallel).
> > >
> > >     Is there a straightforward equivalent to "kill -9 $( lsof -t
> > >     /path/to/buildbot )" on Windows?
> > >
> > >
> > > Difficult to identify which process you want to kill with
> > > Stop-Process.  With PS 4.0 and later you can run ((Get-Process
> > > -IncludeUserName).where({$_.username -AND $_.username -notmatch
> > > "^NT"})) to get the processes owned by the user account running the
> > > command, but there's still too many in there that shouldn't be stopped.
> > >
> > > Maybe Get-Process | Where-Object -Property ProcessName -match
> > > ".*(Process1|Process2|Process3).*" | Stop-Process would do if the
> > > number of processes to look for isn't too bad.
> >
> > How difficult would it be to parse the output of the Sysinternals
> > "Handle" utility in PS? That would presumably tell us which process
> > has the build directory locked while limiting the risk of clobbering
> > any other Buildbot instances that happen to be running.
> >
> ________________________________________________________________
> > ___________
> > Sent via:    Wireshark-dev mailing list 
> > <[email protected]<mailto:[email protected]>>
> > Archives:    https://www.wireshark.org/lists/wireshark-dev
> > Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
> >
> > mailto:[email protected]?subject=unsubscribe
> CONFIDENTIALITY NOTICE: This message is the property of International Game
> Technology PLC and/or its subsidiaries and may contain proprietary,
> confidential or trade secret information.  This message is intended solely for
> the use of the addressee.  If you are not the intended recipient and have
> received this message in error, please delete this message from your system.
> Any unauthorized reading, distribution, copying, or other use of this message 
> or
> its attachments is strictly prohibited.
>
> ________________________________________________________________
> ___________
> Sent via:    Wireshark-dev mailing list 
> <[email protected]<mailto:[email protected]>>
> Archives:    https://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
>              mailto:[email protected]?subject=unsubscribe

CONFIDENTIALITY NOTICE: This message is the property of International Game 
Technology PLC and/or its subsidiaries and may contain proprietary, 
confidential or trade secret information.  This message is intended solely for 
the use of the addressee.  If you are not the intended recipient and have 
received this message in error, please delete this message from your system. 
Any unauthorized reading, distribution, copying, or other use of this message 
or its attachments is strictly prohibited.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe

Reply via email to