Program Exit/Quit via command line

Page 1 of 2 12 LastLast

  1. Posts : 526
    Windows 10 (22H2)
       #1

    Program Exit/Quit via command line


    Programs have a quit or exit option in their menus. I seek the equivalent procedure via the command prompt window. Are these programs invoking the taskkill command? I always understood taskkill to be a strictly windows operative to force stop a process. So, are the various programs really calling the taskkill or do they have their own unique exit code?
      My Computer


  2. Posts : 21,421
    19044.1586 - 21H2 Pro x64
       #2

    I would much rather exit a program gracefully if that works, rather than use an ungraceful taskkill to stop it unless it is unavoidable.
      My Computer


  3. Posts : 526
    Windows 10 (22H2)
    Thread Starter
       #3

    steve108 said:
    I would much rather exit a program gracefully if that works, rather than use an ungraceful taskkill to stop it unless it is unavoidable.
    agreed, all I request is how such a 'graceful' exit can be done via the command line.
      My Computer


  4. Posts : 21,421
    19044.1586 - 21H2 Pro x64
       #4

    MourningStar said:
    agreed, all I request is how such a 'graceful' exit can be done via the command line.
    I don't think it's possible.
      My Computer


  5. Posts : 206
    Win10 Pro 64bit 22H2
       #5

    MourningStar said:
    Programs have a quit or exit option in their menus. I seek the equivalent procedure via the command prompt window. Are these programs invoking the taskkill command? I always understood taskkill to be a strictly windows operative to force stop a process. So, are the various programs really calling the taskkill or do they have their own unique exit code?
    Exit/close buttons on applications often trigger other events such as closing/cleanup relevant resources or processes.

    A taskkill doesn't trigger all other relevant events so some resources/processes the application used, even when forced closed, may still be wandering about for a certain period of time or until the next reboot.
      My Computer


  6. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #6

    Hello @MourningStar,

    Using the actual Programs Close, Exit or Quit, does NOT just perform that particular action, but it also saves ANY changes or amendments in the Configurations Settings etc in the Config or .ini files.

    If you are ever in a situation where you can NOT use ANY of the above to escape from the Program, then you can use this . . .

    > How to Kill a Process in Windows 10

    I hope this helps.
      My Computer


  7. Posts : 2,800
    Windows 7 Pro
       #7

    Taskkill sends WM_CLOSE message to the target program unless /F is specified.

    - - - Updated - - -

    Open notepad type some text in it, use taskkill to close it and notepad will display save dialog.
      My Computers


  8. Posts : 21,421
    19044.1586 - 21H2 Pro x64
       #8

    MaloK said:
    Taskkill sends WM_CLOSE message to the target program unless /F is specified.

    - - - Updated - - -

    Open notepad type some text in it, use taskkill to close it and notepad will display save dialog.
    Thanks. Notepad responded to "taskkill /im notepad.exe", but Firefox.exe could not be exited in the same manner. I guess it only works with some apps without using /F.
      My Computer


  9. Posts : 2,800
    Windows 7 Pro
       #9

    @steve108

    Yes a program like firefox / Chrome and many other that uses multi-Separated processes under the same name.

    Using /im will require the /T switch to request closing of the whole process tree.

    You can use PID to request single instance close in these case....

    Some will terminate gracefully the whole process tree when sending the request to the main instance, some not quite.

    I've never tried to kill a FF / chrome tab "only" seems risky

    All need to be tested.
      My Computers


  10. Posts : 206
    Win10 Pro 64bit 22H2
       #10

    Here's a thread from StackOverflow if anyone wants to close Chrome and related processes via cmd - command line - Close chrome from bat file - Stack Overflow
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 13:49.
Find Us




Windows 10 Forums