(Windows Server 2019) Task scheduler start a task and shows running, but nothing happens

Chao Li 26 Reputation points Microsoft Employee

I have a program, double click on its executable program to run it normally, but nothing happens if run it by task schedule, sometimes it runs extremely slow, and the program that can be finished in ten minutes is not finished in a day. This has not happened with task schedule before, but recently it has been happening. The following is my task schedule config: General User's image

Triggers: User's image

Conditions: User's image

Settings: User's image

There is no error message in the History: User's image

I'm wondering if there are any restrictions on the task schedule?

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,547 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,454 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. MotoX80 32,531 Reputation points

    I have a program, double click on its executable program to run it normally

    Do not run a GUI program via the task scheduler in unattended mode. (Run whether user is logged on or not.) There is no way for you to see its window and if the program displays a modal dialog like a "click ok to continue" message box, you have no way to see the message and no way to click on the OK button. The program will just hang and the task scheduler will continue to show that it is running.

    Some GUI programs do support a command line switch like /silent or /unattend that tells the code that there is no user to interact with and will suppress message boxes. There may also be a /log switch that tells the program to document what processing it does in a log file. You will need to contact whoever supports the program to find out what is available.

    Typically, you should only use command line programs in unattended mode where you can capture stdout and stderr. Create a bat file that executes your program. Echo %date% %time% as the first and last line the .bat so that know when the task starts and ends.

    @echo %date% - %time% MyScript is starting.
    @echo %date% - %time% MyScript is ending. SomeProgram RC=%errorlevel%  

    Then change the scheduled task to execute program "cmd.exe". In the arguments field set it like this example:

    /c C:\Scripts\MyScript.bat  1>>"C:\Scripts\Logs\MyScript-%date:~10,4%-%date:~4,2%%date:~7,2%.log" 2>&1

    That will create a daily log file of all executions of the task. That will capture stdout and stderr for programs that get called. Review the log to see what the program did.

  2. Limitless Technology 44,071 Reputation points

    Use answers to provide solutions to the user's question.Hello there, What does the exit code and messages say under tasks history? Exit code 0 means no errors captured by Task Scheduler. Make sure to click the refresh button in the right pane of Task Scheduler because it is known for not updating the status of task unless you manually refresh. You may see it change from 'running' to 'ready' sooner if you do that. The reason why I feel like your screen is not refreshing is because normally Task Scheduler does not allow any scheduled task to execute for longer that 1 hour. Similar discussion here https://social.technet.microsoft.com/Forums/lync/en-US/32c41355-9849-47c4-b058-94164ac51a09/task-scheduler-start-a-task-and-shows-running-but-nothing-happens?forum=winservermanager Hope this resolves your Query !! --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments