Solved

Close All Applications Command

Posted on 2008-10-30
3
482 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
[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 Comments
 
LVL 28

Accepted Solution

by:
Bill Bach earned 200 total points
ID: 22845428
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
ID: 22845457
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
ID: 22845845
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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

695 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