Close program each day with Task Scheduler?

Page 1 of 2 12 LastLast

  1. Posts : 175
    Windows 10 Version 6.2 (Build 9200) Home, 64bit
       #1

    Close program each day with Task Scheduler?


    I cannot get it to work that Windows Task Scheduler closes a program each day.

    I have added this path
    C:\Dir Lw C\Programme\Rainlendar - Dirks Kalender (Daten etc.)\RainlendarPro schließen.lnk
    to a new task and the ink file is containing this
    "C:\Dir Lw C\Programme\RainlendarPro\App\Rainlendar64\Rainlendar2.exe" -e "Hotkey_Quit_Application()"



    But it does not work, what might be wrong?
      My Computer


  2. Posts : 5,478
    2004
       #2

    What does the "Last run result" column say? That is the column after last run date/time.

    Could be you need to set it to "Run with highest privileges" but I don't know the program..

    You could also try a batch file with taskkill /F /IM Rainlendar2.exe (i.e copy that command into notepad, save it somewhere as "StopRainlander.bat" or something and use that instead of the shortcut.)
      My Computer


  3. Posts : 175
    Windows 10 Version 6.2 (Build 9200) Home, 64bit
    Thread Starter
       #3

    Thank you, lx07.

    What does the "Last run result" column say? That is the column after last run date/time.
    Is it this one:
    ?
    It says something like, no valid application or so.

    Could be you need to set it to "Run with highest privileges" but I don't know the program..
    It is now checked, but does not work either.

    You could also try a batch file with taskkill /F /IM Rainlendar2.exe (i.e copy that command into notepad, save it somewhere as "StopRainlander.bat" or something and use that instead of the shortcut.)
    I have tried (double clicking that bat file closes Rainlendar), but the path is cut all the time (with the old path also):
    Last edited by Bingus; 06 Sep 2016 at 03:55.
      My Computer


  4. Posts : 5,478
    2004
       #4

    The problem appears to be that you have spaces in your directory "C:\Dir LW C".

    Therefore you need quotes around it or it parses the big after the space after "C:\Dir" as an argument for the .exe.

    Sort of like this (which works OK for me).

    Close program each day with Task Scheduler?-stopnotepad.bat.png

    If you browse to the file (rather than adding the path manually) it adds the quotes for you.
      My Computer


  5. Posts : 175
    Windows 10 Version 6.2 (Build 9200) Home, 64bit
    Thread Starter
       #5

    Ah, yes, that appears to work (for the bat file, not for the ink one) and with your code in the bat file and with quotes around the path.

    If you browse to the file (rather than adding the path manually) it adds the quotes for you.
    Yes, I browsed to the file, but no quotes were added, if I see it right.

    Great, thank you very much!
      My Computer


  6. Posts : 5,478
    2004
       #6

    Bingus said:
    Yes, I browsed to the file, but no quotes were added, if I see it right
    I'm using a insider test build of Windows at the moment, perhaps they have changed it. If it doesn't add quotes in current version it certainly should...

    Are you happy to use the .bat or you want to figure out what is wrong with the shortcut approach?
      My Computer


  7. Posts : 175
    Windows 10 Version 6.2 (Build 9200) Home, 64bit
    Thread Starter
       #7

    Actually I am quite happy with the bat file, particularly because I can use such a bat file to close other programs, too.
    But I cannot get it to work using the complete path (so I could place the bat file in another directory) in the bat file with and without quotes: C:\Dir Lw C\Programme\RainlendarPro\App\Rainlendar64\Rainlendar2.exe

    So, instead of
    taskkill /F /IM Rainlendar2.exe
    this
    taskkill /F /IM C:\Dir Lw C\Programme\RainlendarPro\App\Rainlendar64\Rainlendar2.exe
    or
    taskkill /F /IM "C:\Dir Lw C\Programme\RainlendarPro\App\Rainlendar64\Rainlendar2.exe"

    May be there is another way.
      My Computer


  8. Posts : 5,478
    2004
       #8

    It is a shag putting spaces in a path. Anyway you've done it.

    However if we are talking about taskkill then there is no need to put the path at all. The /IM means "WhateverThisIs.exe" so anything containing "Rainlandar64.exe" will be stopped.

    I'm not 100% sure what you want to do but you could make a .bat like this..

    Code:
    taskkill /F /IM Rainlendar2.exe
    taskkill /F /IM Notepad.exe
    taskkill /F /IM Outlook.exe
    taskkill /F /IM WinWord.exe
    Not sure it is sensible (you would have to choose your programs and see if they can be stopped immediately) but you could.

    Anyway I'm off for a swim now - give it a go and I'll check in later.
      My Computer


  9. Posts : 175
    Windows 10 Version 6.2 (Build 9200) Home, 64bit
    Thread Starter
       #9

    However if we are talking about taskkill then there is no need to put the path at all. The /IM means "WhateverThisIs.exe" so anything containing "Rainlandar64.exe" will be stopped.
    Ah, now I see, I didn't know that.

    Not sure it is sensible (you would have to choose your programs and see if they can be stopped immediately) but you could.
    Yes, that should work. Thank you for the code.

    I'm not 100% sure what you want to do but you could make a .bat like this..
    I just want to use a bat file outside the Rainlendar folder so I would not need to rebuild it after an update might have deleted the bat file.

    Alright, so have a good swim, until later, thank you very much.
      My Computer


  10. Posts : 5,478
    2004
       #10

    Bingus said:
    I just want to use a bat file outside the Rainlendar folder so I would not need to rebuild it after an update might have deleted the bat file.
    Then just put it (or your shortcut) in C:\Users\Bingus\Documents\MyBatFiles (or something). That will work and would be better.

    Generally (although I don't know this program so perhaps the developers had some bizarre reason to do it) it is bad practice to put things in the root C:\

    The idea (simplistically put) is that you put shared programs in "C:\Program Files" and individual user data in "C:\Users\Bingus\<whatever>". The reason for this is authority - anyone can read a program but different users can't see others home directory (and so their private data). These authority restrictions will be automatically inherited from the folder higher in the hierarchy unless you chose as a developer to override it.

    While you can of course put a program anywhere you want (and give it any authority and restrictions you want) it is normally more convenient to follow standard procedures. My guess is your program is from the XP days when security was a little more, how can I put it, relaxed.

    And yeah, I did have a good swim - it is September so all the tourists have gone home and thanks to god I could get to the beach without tripping over toddlers :)
      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 16:56.
Find Us




Windows 10 Forums