Solved

Close All Applications Command

Posted on 2008-10-30
3
476 Views
Last Modified: 2012-08-13
Experts,

A network backup program requires that all my applications be closed on my machine before it will back up my data.  I'd like to create a batch job that kicks in at a certain time and closes them all automatically so I don't forget.  Is there a way to do this in WindowsXP?

0
Comment
Question by:NigelRocks
3 Comments
 
LVL 28

Accepted Solution

by:
Bill Bach earned 200 total points
Comment Utility
Closing applications might be tough because it's hard to tell what is an application and what is a service from an automated script.  

What about just logging off?  You can enable a screen-saver that forces a logoff (in case you forget).  Logging off leaves the OS running, but with no applications running (only services).

Check here to get started:
    http://windowsxp.mvps.org/winexit.htm
0
 
LVL 7

Assisted Solution

by:talker2004
talker2004 earned 150 total points
Comment Utility
This is beyond the capabilities of a batch file.

I would be able to do this with a programming language like vb.net or c#.

However there is a new scripting tool called powershell which i am sure could do it.
This is the new way to do batch files. Unfortunately i have no experience with powershell but i found an article that explains how to stop a process via powershell.

http://www.computerperformance.co.uk/powershell/powershell_process.htm

0
 
LVL 38

Assisted Solution

by:Shift-3
Shift-3 earned 150 total points
Comment Utility
Here's a fairly crude way to do it using vbscript.

Paste the script below into a text file with a .vbs extension.  Running it will terminate any processes running under the current user's credentials.  

Be warned that this just kills the processes.  It does not close programs gracefully, so any unsaved data will be lost.  It might produce undesirable results with some programs.  Use with caution.


Set objShell = CreateObject("WScript.Shell")

strUserName = objShell.ExpandEnvironmentStrings("%username%")

strUserDomain = objShell.ExpandEnvironmentStrings("%userdomain%")
 

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
 

Set colProcessList = objWMIService.ExecQuery _

    ("Select * from Win32_Process")
 

For Each objProcess in colProcessList

    objProcess.GetOwner strProcUser, strProcDomain

    If LCase(strProcDomain & "\" & strProcUser) = LCase(strUserDomain & "\" & strUserName) Then

        objProcess.Terminate

    End If

Next

Open in new window

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now