+ Reply to Thread
Results 1 to 7 of 7

How Close Excel from CMD prompt?

  1. #1
    Al Franz
    Guest

    How Close Excel from CMD prompt?

    Have an automated Excel routine I run on a PC, but the one problem I have is
    that if Excel is already open I get an error if it tries to open excel
    again.

    Is there a way to make sure Excel is closed from a Command Prompt in my
    Batch File?



  2. #2
    Jake Marx
    Guest

    Re: How Close Excel from CMD prompt?

    Hi Al,

    Al Franz wrote:
    > Have an automated Excel routine I run on a PC, but the one problem I
    > have is that if Excel is already open I get an error if it tries to
    > open excel again.
    >
    > Is there a way to make sure Excel is closed from a Command Prompt in
    > my Batch File?


    IMO it would be better to figure out why this is happening instead of
    killing Excel. But if you must terminate a process from a batch file,
    here's how you could do it:

    taskkill /F /IM EXCEL.EXE

    Note - this will kill Excel just like it would if you killed it from task
    manager, so you'll lose anything you had open and unsaved.

    --
    Regards,

    Jake Marx
    MS MVP - Excel
    www.longhead.com

    [please keep replies in the newsgroup - email address unmonitored]


  3. #3
    Dave Peterson
    Guest

    Re: How Close Excel from CMD prompt?

    Is taskkill available in all versions of windows?

    (Or better, what version of windows are you running?)

    It wasn't found in WinXP Home edition.

    Jake Marx wrote:
    >
    > Hi Al,
    >
    > Al Franz wrote:
    > > Have an automated Excel routine I run on a PC, but the one problem I
    > > have is that if Excel is already open I get an error if it tries to
    > > open excel again.
    > >
    > > Is there a way to make sure Excel is closed from a Command Prompt in
    > > my Batch File?

    >
    > IMO it would be better to figure out why this is happening instead of
    > killing Excel. But if you must terminate a process from a batch file,
    > here's how you could do it:
    >
    > taskkill /F /IM EXCEL.EXE
    >
    > Note - this will kill Excel just like it would if you killed it from task
    > manager, so you'll lose anything you had open and unsaved.
    >
    > --
    > Regards,
    >
    > Jake Marx
    > MS MVP - Excel
    > www.longhead.com
    >
    > [please keep replies in the newsgroup - email address unmonitored]


    --

    Dave Peterson

  4. #4
    Jake Marx
    Guest

    Re: How Close Excel from CMD prompt?

    Dave Peterson wrote:
    > Is taskkill available in all versions of windows?
    >
    > (Or better, what version of windows are you running?)
    >
    > It wasn't found in WinXP Home edition.


    Interesting...I don't know. I'm running XP Pro SP2.

    --
    Regards,

    Jake Marx
    MS MVP - Excel
    www.longhead.com

    [please keep replies in the newsgroup - email address unmonitored]


  5. #5
    Scott
    Guest

    Re: How Close Excel from CMD prompt?

    According to ITWorld.com, TaskKill is only included in XP Pro.
    --
    Scott


    "Jake Marx" wrote:

    > Dave Peterson wrote:
    > > Is taskkill available in all versions of windows?
    > >
    > > (Or better, what version of windows are you running?)
    > >
    > > It wasn't found in WinXP Home edition.

    >
    > Interesting...I don't know. I'm running XP Pro SP2.
    >
    > --
    > Regards,
    >
    > Jake Marx
    > MS MVP - Excel
    > www.longhead.com
    >
    > [please keep replies in the newsgroup - email address unmonitored]
    >
    >


  6. #6
    Dave Peterson
    Guest

    Re: How Close Excel from CMD prompt?

    Thanks to both you and Jake.

    Here's a link that describes the parms:
    http://www.microsoft.com/resources/d.../taskkill.mspx
    (one line in your browser)

    And searching the web for alternatives (for WinNT 4.x):
    http://www.computing.net/windowsnt/w...rum/22493.html

    And a free alternative:
    http://www.sysinternals.com/Utilities/PsTools.html
    or directly...
    http://www.sysinternals.com/Utilities/PsKill.html


    Scott wrote:
    >
    > According to ITWorld.com, TaskKill is only included in XP Pro.
    > --
    > Scott
    >
    > "Jake Marx" wrote:
    >
    > > Dave Peterson wrote:
    > > > Is taskkill available in all versions of windows?
    > > >
    > > > (Or better, what version of windows are you running?)
    > > >
    > > > It wasn't found in WinXP Home edition.

    > >
    > > Interesting...I don't know. I'm running XP Pro SP2.
    > >
    > > --
    > > Regards,
    > >
    > > Jake Marx
    > > MS MVP - Excel
    > > www.longhead.com
    > >
    > > [please keep replies in the newsgroup - email address unmonitored]
    > >
    > >


    --

    Dave Peterson

  7. #7
    Registered User Ivan F Moala's Avatar
    Join Date
    10-25-2003
    Location
    Auckland, New Zealand
    Posts
    71
    Another option to close Excel using WMI
    NB: Si,ilar to Jakes in that it terminates as per Taskmanager

    Please Login or Register  to view this content.
    Currently, WMI is included when you install;

    Microsoft® Windows® 2000,
    Windows XP,
    Windows Millennium Edition (Me).


    For those running Windows 95 OSR 2, Windows 98 or Microsoft® Windows NT® 4.0, a WMI installation package can be downloaded from Microsoft® MSDN® which offers similar functionality as WMI in Windows 2000, Windows XP, and Windows Me.

    http://download.microsoft.com/downlo...N-US/wmi9x.exe
    Kind Regards,
    Ivan F Moala From the City of Sails
    \1

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1