Solved

Close All Applications Command

Posted on 2008-10-30
3
480 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

756 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