Solved

Is it possible to create a script or batch to taskkill on application close?

Posted on 2010-09-10
6
597 Views
Last Modified: 2012-05-10
I have an exe application that throws a .NET error when you close the GUI.  The .NET error is persistent and requires that you 'end process' on the exe in order to get rid of the error and actually close the running exe.  I have created a batch that I can run using taskkill /IM application.exe /F and it kills the exe and will also kill the .NET error.  My question is this.  Can I have a script or batch file launch the exe application (instead of using the actual exe shortcut) and then when I close the GUI, the script or batch will taskkill the exe process for me?  Currently, I launch the exe with its default shortcut, then have to launch the taskkill batch after I close the GUI.  Most of my users will either forget or will still be upset with the extra step.  Any options here?
0
Comment
Question by:murryc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 7

Expert Comment

by:compaqus
ID: 33649395
Usually a bat file will wait until the command is complete (program closed) then continue.

Just tested that.

you can also put the command to run the application in second.bat and then, from the first.bat, use "call second.bat" and then the kill thing. It will wait until the other bat is finished.
0
 
LVL 7

Expert Comment

by:compaqus
ID: 33649426
the thing is, if the exe is still running the bat will not continue.... hmm...
0
 
LVL 7

Accepted Solution

by:
compaqus earned 500 total points
ID: 33649461
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:murryc
ID: 33649473
you guessed it.  I wonder if it is possible for a script or batch to monitor the existence of the GUI.  It closes, but the exe remains running.
0
 

Author Comment

by:murryc
ID: 33649527
I know what would work, but I need someone to build the script...

Script this.

launch exe application
open small dialog box with button that says Close Application.
place the dialog box at the very top left corner of the desktop
user will then use the applciation and close it
.NET error will appear but user will just click the close application button in the desktop corner
button will execute taskkill /im application.exe /f
script will end
0
 

Author Comment

by:murryc
ID: 33649548
the other application you suggested requires installation. I am trying to do this without having to install anything.  I think the script action above will work, just need someone to script it for me.  
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question