Commands to close an application

Solved
Lcf.vs -  
 Noxhol -
Hello everyone...

I am looking for the simplest possible commands to close an application...

In my opinion, it should be in batch or DOS, but I don't know how to go about it... I know the taskkill command in DOS, but what I need is to write it in a file so I can schedule its execution...

Thank you in advance...

Lcf.vs

13 answers

  1. k2m59@hotmail.com
     
    Hello, everyone... for my brother who wants to automate the process of closing an application, I suggest using BATCH, which is a type of program that contains MS-DOS commands. To create this type of file, simply write your commands in a notepad and save it with a .bat extension instead of .txt.
    So to close Firefox, for example, you would write in a notepad:
    TASKKILL /f /im firefox.exe
    */f: to force the process to stop :p
    */im: because you point to Firefox with the process image, the process is:
    then save the text with the *.bat extension (example: teste.bat if you have extensions displayed :p if not, put the text file on the desktop and execute this command: rename *.txt *.bat)
    Once the extension is changed, just double-click it and OP!!! It’s done!!! Firefox will close!!!
    And if you want to run it at startup (I guess!!! :p), just copy it to the following directories:
    C:\Documents and Settings\All Users\Menu Démarrer\Programmes\Démarrage
    C:\Documents and Settings\Administrateur\Menu Démarrer\Programmes\Démarrage
    and the action will take place at startup....
    If you need help, here's my MSN, I'd be happy to help you (and the others of course!!!) k2m59@hotmail.com
    41
    1. bruno
       
      thank you
      I know the post is old, but good solutions don't fade over time.
      Command line directly pasted as a new shortcut on the desktop
      C:\Windows\System32\taskkill.exe /f /im skype.exe
      works very well on Windows 8.1, perfect for completely closing Skype in two clicks :)
      0
    2. CurtisMukam Posted messages 2 Status Member
       
      You're awesome, my brother.
      0
    3. CurtisMukam Posted messages 2 Status Member
       
      Quel est le code source de ce dernier, s'il vous plaît ?
      0
    4. ninous
       
      Thank you very much. How do I make it execute every day at 1 PM, for example?
      0
    5. Lili
       
      You use scheduled tasks (Control Panel, administrative tools, task scheduler)
      0
  2. Lcf.vs Posted messages 144 Status Member 36
     
    The question wasn't "simpler than taskkill" but rather that according to this process, one must be present...

    Me, I would like it to be in a file to automate it...

    Thank you
    1
  3. Husky_3d Posted messages 19 Status Member 1
     
    I am really happy to come across these messages.
    Several people (pros) told me it was
    impossible… Grrr…
    To make things more complicated, is it possible to give
    a delay? That is to say, to say "Okay, you can close the software
    but in 1 minute 30 seconds."?...
    If I get an answer, a big thank you because I’ve searched like
    a damned soul…
    Warm regards.
    Sylvain
    1
    1. le druide
       
      cls
      echo off
      PING localhost -n 20 -w 1000
      "E:\Program Files\Windows Media Player\test.mpg"
      PING localhost -n 20 -w 1000
      TASKKILL /f /im wmplayer.exe

      The program opens in 20 seconds and closes 20 seconds after if taskkill works, of course, but everything else works.
      0
  4. sebsauvage Posted messages 33284 Registration date   Status Moderator Last intervention   15 684
     
    Simpler than Taskkill? I don't see it.

    taskkill /F /IM notepad.exe, I don't see how to make it easier to terminate Notepad.

    I don't quite understand what problem you're trying to solve.

    --
    “Life is short - You need Python” -- Bruce Eckel, member of the ANSI C++ committee
    0
    1. Husky_3d Posted messages 19 Status Member 1
       
      How can I delay this? That is to say, "don't close this program
      until after 1 minute and 30 seconds"?
      Thank you
      Best regards
      Sylvain
      0
    2. Maximilien
       
      @echo off REM delay of 1 minute and 30 seconds = 90 seconds ping localhost -n 90 REM closing notepad.exe taskkill /f /im notepad.exe 


      where 90 = 60+30=1 minute and 30 seconds
      0
    3. max
       
      Hello
      I would like to know how to prevent the countdown from displaying seconds.
      0
    4. selrak Posted messages 16 Status Member
       
      You just have to add ">nul" after the command EX:

      timeout /t 20 >nul
      choice /c:abcd >nul
      pause >nul
      0
  5. sebsauvage Posted messages 33284 Registration date   Status Moderator Last intervention   15 684
     
    I would like it to be in a file to automate it...

    Well... you can put the taskkill command in a batch file, can't you?

    --
    “Life is short - You need Python” -- Bruce Eckel, member of the ANSI C++ committee
    0
  6. Lcf.vs Posted messages 144 Status Member 36
     
    oki but how do we do it?

    I've tried this:

    taskkill application address

    but it's not working...
    0
  7. sebsauvage Posted messages 33284 Registration date   Status Moderator Last intervention   15 684
     
    and putting it as I indicated?

    taskkill /F /IM programname
    --
    “Life is short - You need Python” -- Bruce Eckel, member of the ANSI C++ committee
    0
    1. dean76
       
      this command does not work on win xp.
      0
    2. lebad
       
      no, this command does not work on Windows XP Home Edition, but it does work on XP Pro versions.
      0
  8. Lcf.vs Posted messages 144 Status Member 36
     
    oki, sorry, the /f /im I thought it only applied to notepad...

    A big thank you to you...

    Lcf.vs
    0
  9. Larune
     
    Lol lol thanks Reby, it's often like that, I've been looking for a bat for two days to close all the applications (by creating a keyboard shortcut pointing to the .bat) as long as they are active and hop, just like that, in a simple sentence you solve my problem
    thanks
    0
  10. Husky_3d Posted messages 19 Status Member 1
     
    Ok. I use a small AI software that
    sends command lines.
    c:/my_pc/My_images/My_daughter.jpg
    It works perfectly but I would like it to
    stay displayed for a certain time before closing
    the application. For example:
    taskkill /F /IM notepad.exe blabla but after 1 minute and 30 seconds
    (for example or something else)
    If you solve this old problem for me, I ..
    I don't know what but I would be very happy :0)
    Best regards
    Sylvain
    0
    1. le druide
       
      "your thing then"
      PING localhost -n 20 -w 1000 (that’s 20 seconds for you)
      TASKKILL /f /im xxxxxx.exe (xxxxx.exe = example of the program to stop since you open your photo with a program)
      0
    2. KonVict
       
      You can use "<b>ping localhost -n</b><i> NUMBEROFSECONDS </i><b>>nul</b>" <br /> <br />example: <br /> <br /><b>@echo off <br /> <br />Title Close Notepad <br /> <br />ping localhost -n 120 >nul <br />taskkill /f /im notepad.exe</b> <br /> <br />When you run this program in 2 minutes (120 seconds), the Notepad program will close.
      0
  11. Husky_3d
     
    I'm sorry, but I can't assist with that.
    0
    1. le druide
       
      I completely understood, and I'll explain it to you just above.
      0
  12. jojeka Posted messages 16 Status Member
     
    hello,

    is there still anyone around?

    for the info Husky_3d

    the command is
    ping localhost -n 2 [for 2 seconds]

    ps: it works with seconds ;)

    now it's my turn ;-)

    so I'm looking for the command to close an open image
    with Windows Photo Viewer

    because I've tried everything looking in task manager etc. to know the exact name

    for the bat code
    taskkill /IM_icijemetkoi_ /F

    thank you in advance
    0
    1. Husky_3d Posted messages 19 Status Member 1
       
      Ok thanks, I'm going to test that. For now, I can close an application but
      not its open file. That is, I can open and close NotePad.exe but not
      the text file itself.
      Husky.
      0
    2. jojeka
       
      You're welcome, sorry for not getting back to you earlier as I've been quite busy lately lol

      Keep me updated if you find anything else; otherwise, you'll have to show me your coding because I'm not quite getting it. By the way, it works for me; it closes when I ask it to, my text, so that's good.


      I would also have a question for the forum if there are still people around

      I would like to know the coding, still in batch, on how to hide media player or another music player

      Thanks in advance
      jojeka
      0
  13. jojeka Posted messages 16 Status Member
     

    @echo off
    echo.
    echo voilà ça va se fermer dans 90 secondes
    echo.
    echo hi hi tout simplement avec un txt
    echo.
    echo.
    ping localhost -n 90
    taskkill /IM notepad.exe /F
    echo.
    echo.
    echo pour refermer ta commande en auto dans 5 secondes
    ping localhost -n 5
    exit

    voilà un code de A à Z et de Z à A accompagné en bonus pour la nouvelle année xD
    un texte d'accompagnement

    de mon côté

    et bien pas trop eu le temps ces jours-ci à me remettre dessus mais merci en tout cas pour vos réponses et ainsi je m'excuse du retard à répondre

    je n'ai toujours pas trouvé comment cacher média player ou ( vlc ), en codage si quelqu'un aurait une solution ou un départ serait cool
    merci d'avance
    0