How to I set variables when using taskkill?

November 4, 2011 at 04:31:30
Specs: N/A
G'day,

I would like to "kill" everything except explorer.exe... For obvious reason...

I had taskkill /im * /f something like that

Which kills everything....

Then I had taskkill /im a* /f and followed by next line with "b*" and so on....

But if c* doesn't exist it errors out....and will shutdown the batch file....

Can "IF" be used here ? And how could I use it.... if not *c goto next line...


See More: How to I set variables when using taskkill?

Report •

#1
November 4, 2011 at 08:23:53
I would like to "kill" everything except explorer.exe... For obvious reason...
You wish to leave the computer in an unusable state?

But if c* doesn't exist it errors out....and will shutdown the batch file....
Actually, batch files are run by cmd.exe, so you're killing the script parser. With the script parser killed, obviously there's nothing left to run your script.

How To Ask Questions The Smart Way


Report •

#2
November 5, 2011 at 03:38:09
Thanks for that didn't really think of it that way....

Want I wanted was to close all my apps that I opened and shut them down quickly to logout etc.... I have written my self a list of all my apps that I use and will add them in....

:-p thanks :)


Report •

#3
November 5, 2011 at 13:38:17
Why would you want to do that?

The normal Windows shut down procedure does it automatically. Shutting down application via Taskkill can cause problems with open files not being closed correctly and buffers not being flushed , Better let Windows do it properly.

Taskill is really only designed to kill tasks that have become unresponsive due to an error. Not for routine closing down of the system.
Stuart


Report •
Related Solutions


Ask Question