You are here

Finally! Simple and effective close / kill all process / eject solution (no code writing!)

17 posts / 0 new
Last post
johnnyh
Offline
Last seen: 16 years 3 months ago
Joined: 2006-04-24 11:23
Finally! Simple and effective close / kill all process / eject solution (no code writing!)

For those who don't want to take the time to write any code, here is a very simple and effective close all and auto eject.

You will need the great little app "Command line process utility" available from here (scroll to near bottom of page for .zip dl):
http://www.beyondlogic.org/consulting/processutil/processutil.htm

Put it in its own folder in your PortableApps folder. Now open a text editor (Notepad) and type in the processes you want to close, in the following format: [note: "-k"=kill / "-q"=close]
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k winamp.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -q KeePass.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k KeePass.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k Launchy.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k Convey.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k cm2.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -q SyncBack.exe
"E:\PortableApps\CMDLprocess_utility\Process.exe" -k FIREFOX.exe

Once you have all the .exe's listed you normally are running and want to close in the above format, save the file with a .bat extension and save it in the same folder as the Process.exe. I called mine "kill_all.bat". You can add exe's to it anytime by opening and editing it in Notepad.

Then set PStart (or whatever) to run your .bat (ie: "kill_all.bat") on close. Presto, closes all the programs you want on exit.

I also set the eject shortcut "%windir%\system32\RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll" to autorun on exit. So the eject dialog is ready to go once the .bat is done.

Two notes; One, make sure your drive is not being written to when you run the .bat. Two, if you try "-q" close a process that doesn't respond, Process.exe will take 60 seconds before it kills the process which is annoying.

Therefore, I see no reason not to kill all the processes as long the drive is not being written to. I've done this for months and haven't lost 1 byte of data.

Aciago
Aciago's picture
Offline
Last seen: 11 months 3 weeks ago
Joined: 2007-01-24 14:23
Fine idea

I use PStart and run ejectscript on exit, but rainlendar and mIRC don't close with this... I'll try this one...

Thanks!

If a packet hits a pocket on a socket on a port,
and the bus is interrupted as a very last resort,
and the address of the memory makes your floppy disk abort,
then the socket packet pocket has an error to report Biggrin

Bahamut
Bahamut's picture
Offline
Last seen: 12 years 10 months ago
Joined: 2006-04-07 08:44
Therefore, I see no reason

Therefore, I see no reason not to kill all the processes as long the drive is not being written to. I've done this for months and haven't lost 1 byte of data.
Wrong! You won't lose any data already written to disk, but most applications save data at close. If you kill them, they won't save that data, and that data will be lost. Let the programs close like they're supposed to. You also didn't take into account handles from programs not on the drive on files that are. And the little light on the drive will not be on just because of an open handle.

Vintage!

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 15 years 3 days ago
Joined: 2006-01-06 21:27
Exactly

explorer.exe is the most notorious one for keeping a handle open on the files.

"If you're not part of the solution, you're part of the precipitate."

Bahamut
Bahamut's picture
Offline
Last seen: 12 years 10 months ago
Joined: 2006-04-07 08:44
Also, I'd like to add that

Also, I'd like to add that Process Explorer is an excellent tool for finding and closing open handles.

Vintage!

johnnyh
Offline
Last seen: 16 years 3 months ago
Joined: 2006-04-24 11:23
True, some caution should be

True, some caution should be used... I only use this method on programs that don't save with a prompt at close. Or programs where you've saved settings.
Firefox- just make sure you're not writing to the drive with a bookmark.
PIM- helps if they auto-backup constantly like ChaosManager or KeePass
Basically, go through your list of close/kill programs and know how they will react to this process.

My windows eject goes through 95% of the time and the whole process takes about 4 seconds. The 5% of the time is usually some MS related BS.

rab040ma
Offline
Last seen: 3 months 6 days ago
Joined: 2007-08-27 13:35
CloseAll

CloseAll from http://www.ntwind.com/software/utilities/close-all.html seems to be pretty well-behaved. It doesn't force things, just behaves as if you had clicked on the X. Seems to leave things running in the notification tray though.

For programs that don't respond, you can use Process Explorer.

MC

Bahamut
Bahamut's picture
Offline
Last seen: 12 years 10 months ago
Joined: 2006-04-07 08:44
Seems to leave things

Seems to leave things running in the notification tray though.
Things in the tray don't have windows.

Vintage!

powerjuce
powerjuce's picture
Offline
Last seen: 13 years 7 months ago
Developer
Joined: 2007-09-20 21:34
is there a program that will

is there a program that will close programs on the system tray (mainly Miranda IM)
with out forcing it to quit?

Please search before posting. ~Thanks

Bahamut
Bahamut's picture
Offline
Last seen: 12 years 10 months ago
Joined: 2006-04-07 08:44
Yeah. The program in the OP

Yeah. The program in the OP (-q switch) should work fine.

Vintage!

powerjuce
powerjuce's picture
Offline
Last seen: 13 years 7 months ago
Developer
Joined: 2007-09-20 21:34
OP?

wat is it?

Please search before posting. ~Thanks

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 15 years 3 days ago
Joined: 2006-01-06 21:27
Original Post

OP either means Original Post or Original Poster (In this case, the former).

"If you're not part of the solution, you're part of the precipitate."

Caehan
Caehan's picture
Offline
Last seen: 1 year 7 months ago
Joined: 2007-10-19 22:51
Might not be what it says it is...

My McAfee detected this as a threat and removed it. This program might not be what it says it is.

digitxp
digitxp's picture
Offline
Last seen: 13 years 2 weeks ago
Joined: 2007-11-03 18:33
Huh?

Is there a program for this (the best scripting I know is JavaScript)

Insert original signature here with Greasemonkey Script.

xcomspi
Offline
Last seen: 16 years 2 months ago
Joined: 2007-09-19 12:51
incorporate?

is there a way for this to be incorporated in a future release of the PortableApp menu?
i.e. when you hit the X to close the menu program in bottom right corner, it could trigger the closing of all portable programs listed on its menu. if you install a new portable app, when you hit the refresh program list, could it check to see what new programs are on there & auto-add to the command? or in options, give it a kill / close option (or manual edit)

might slow down the process a little when exiting, but still work & makes sure you won't accidentally eject in the middle of something Smile

Riax
Riax's picture
Offline
Last seen: 9 years 4 months ago
Joined: 2007-09-06 14:41
This may or may not be

This may or may not be feasible, but I think it would be a better idea to simply add support for a switch such as "/close" or "/quit" to each launcher. Then, if you use PStart or something similar, you could make PA platform each launcher close its corresponding application correctly.

Also, if something like that is possible, it would also be relatively easy to make the PA menu simply run each PA.com-formatted launcher with the appropriate switch when you exit the menu. To make it a bit more efficient, the menu could use an array or even an ASCII file to keep track of which PA.com launchers were executed from the menu during the active session. That way, the menu would only attempt to close programs that were active at some point, rather than everything in the menu.

It might also be possible to make the menu keep track of which PA.com-formatted applications are actually running, which could make it even more efficient. I'm no expert programmer, but I think that might be a bit easier if the menu knew exactly what the process name of the actual application (not the launcher) was. If that would be too hard for the menu to somehow detect, another key could be added to the AppInfo file for each PA application which would contain the process name.

Just some things to think about. Smile

Her song leaves the other side in flight for their lives now;
They are not long for the world.
No one leaves; line up for inevitable wipeout.
All you've done - now it's what you deserve.
Machinae Supremacy ~ Laser Speed Force

johnnyh
Offline
Last seen: 16 years 3 months ago
Joined: 2006-04-24 11:23
I'm glad I found this... I

I'm glad I found this... I suffered a unrecoverable RAID failure AND a USB death on the same night. Talk about bad luck!

So I get to spend the next couple days rebuilding my drive. Oh well... this will force me to slim down the drive, getting rid of those Apps I never use.

Log in or register to post comments