Windows scheduler runs only a half of my script.

Anonymous
2023-02-07T07:16:04.2733333+00:00

Hi there. I have a problem with running my script by Windows Scheduler. When I start this batch file by clicking it, everything is fine, but the scheduler runs only half of it. It kills the process, but it is not starting "wfserver.exe".exe. I set up a scheduler to run it with the highest privileges, I also tried to set up a “SYSTEM” user to run it, and I am logged in as an administrator. I also tried creating a shortcut and set it up to be run as an administrator. Nothing worked. Any advice on how to fix it?

@echo off

if not "%minimized%"=="" goto :minimized

set minimized=true

start /min cmd /C "%~dpnx0"

goto :EOF

:minimized

taskkill /f /IM wfserver.exe

TIMEOUT /T 2

wfserver.exe --start

TIMEOUT /T 2 /NOBREAK

EXIT /B

Windows Server 2016
Windows Server 2016
A Microsoft server operating system that supports enterprise-level management updated to data storage.
2,370 questions
0 comments No comments
{count} votes

Accepted answer
  1. Limitless Technology 43,931 Reputation points
    2023-02-07T16:56:04.51+00:00

    Hello

    Thank you for your question and reaching out. I can understand you are having query\issues related to Task scheduler.

    In your batch please try to put full path of wfserver.exe for Example "C:\Programs files\wfserver.exe --start "

    Also put a date /T and time /T in the beginning and in the end of that batch file, you will get the times it was at that point and you can map your script running time and order.

    --If the reply is helpful, please Upvote and Accept as answer--

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2023-02-08T06:16:35.95+00:00

    Adding the path solved my problem, thanks a lot! Could you show me an example of putting a date in a batch file? Thanks in advance.

    0 comments No comments