Windows 10: Close program each day with Task Scheduler?

Page 1 of 2 12 LastLast

  1. Posts : 56
    Windows 10 Version 6.2 (Build 9200) Home, 64bit
       06 Sep 2016 #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 ComputerSystem Spec

  2.    06 Sep 2016 #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 ComputerSystem Spec


  3. Posts : 56
    Windows 10 Version 6.2 (Build 9200) Home, 64bit
    Thread Starter
       06 Sep 2016 #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 ComputerSystem Spec

  4.    06 Sep 2016 #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).

    Click image for larger version. 

Name:	StopNotepad.bat.PNG 
Views:	27 
Size:	9.5 KB 
ID:	100129

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


  5. Posts : 56
    Windows 10 Version 6.2 (Build 9200) Home, 64bit
    Thread Starter
       06 Sep 2016 #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 ComputerSystem Spec

  6.    06 Sep 2016 #6

    Bingus said: View Post
    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 ComputerSystem Spec


  7. Posts : 56
    Windows 10 Version 6.2 (Build 9200) Home, 64bit
    Thread Starter
       06 Sep 2016 #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 ComputerSystem Spec

  8.    06 Sep 2016 #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 ComputerSystem Spec


  9. Posts : 56
    Windows 10 Version 6.2 (Build 9200) Home, 64bit
    Thread Starter
       06 Sep 2016 #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 ComputerSystem Spec

  10.    06 Sep 2016 #10

    Bingus said: View Post
    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 ComputerSystem Spec


 
Page 1 of 2 12 LastLast

Related Threads
Does anyone know how to have Task Scheduler start a program to run with the launch of ANY Office application? I have a registry edit which will enable the black theme in Office 2016. It needs to be run each time any Office app opens. I can do...
Task Scheduler doesn't run program in Performance & Maintenance
I'm running a task schedule to run a program at a certain time. It worked great in windows 7 but since I upgraded to 10 nothing happens when the task is run. I've run SFC and Dism see below and no problems found. C:\WINDOWS\system32>sfc /scannow...
Hi, I'm trying to set up a task using Task Scheduler to run a game which is on one of my secondary drives, drive F: - I have Windows 10 installed on the C: drive. The problem I'm having is Task Scheduler doesn't seem able to start a program if...
Is there a way to make the "Command Prompt" window show when I have a task running in Windows task Scheduler? I would like to be able to view the progress of the task. For example, I have a program called "Zap2xml" that collects TV EPG data. It...
I have installed Speedfan and it won't run at the windows startup, so I tried to schedule it in task scheduler, I am not familiar with using it and wondered if there is a guide for W10 64 anywhere or if anyone can tell me how? Many thanks in...
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 11:48.
Find Us