1.    07 Jan 2016 #1
    Join Date : Jan 2016
    Posts : 7
    Windows 10

    Task Scheduler and Bat File Problem


    Not sure which forum to post this in, but hopefully someone has some insight and can help me with this.

    I have a simple .bat file that stops my media server, creates an archive of a folder (for backup purposes), and then starts the media server again. It works perfectly if I double click the .bat file, or if I run the bat file from the command prompt.

    When I run it from Windows Task Scheduler, however, it does not work properly. The media server does not shut down. If I look in the task manager, though, I see that the archiving program has started. It is difficult to see what is happening because, unlinke when running this in CMD, when it is run from the task scheduler it produces no output to see if there is an error message.

    Why would it run differently from the task scheduler than when I simply double click the .bat file? I have chosen to run it from the same user account, and also selected "run with highest privileges."

    Here is the bat file. The first line stops the media server. The second line runs the archiving process (using 7zip). The third line starts the media server again. Again, it works perfectly if I simply double click the bat file.

    @echo off
    taskkill /im "plex media server.exe"
    7za u C:\plexbackup.7z C:\plexdata -mx0 -up1q0r2x1y2z1w2
    "C:\Program Files (x86)\Plex\Plex Media Server\plex media server.exe"
    Anyone have insight?

      My System SpecsSystem Spec

  2.    07 Jan 2016 #2
    Join Date : Oct 2014
    Posts : 321
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64

    In Task Scheduler Enable All Tasks History
    Run the scheduled task
    Refresh, and look at the History tab for that task.
    Look at each entry in history and see if you can find an error message/code for any step in the task run.
      My System SpecsSystem Spec

  3.    07 Jan 2016 #3
    Join Date : Oct 2014
    Posts : 321
    Windows 10x64 14936

    If you run it with standard privileges it should display a console window and you should be able to see any error messages.
      My System SpecsSystem Spec

  4.    07 Jan 2016 #4
    Join Date : Jan 2016
    Posts : 7
    Windows 10

    I solved the problem by disabling the feature "run whether the user is logged on or not." With that disabled the batch script runs as it should and the output is visible in the command shell.
      My System SpecsSystem Spec


Similar Threads
Thread Forum
Solved Task Scheduler
Will this work without username password logging on? In windows7 you had to have password to make it work.
Installation and Setup
file save & task scheduler
I save my backup files on a separate PC which I am using for storage of pictures . how can I setup the task scheduler on my main PC to start my 2nd PC to backup my files, and after 30minutes using the task scheduler on PC 2 to ask if I wanted to...
Network and Sharing
How to show Command Prompt Window when running task in Task Scheduler?
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...
General Support
Task Scheduler problem - Past Windows 7 tasks give error popups
After an in-place upgrade from Windows 7 to Windows 10, Task Scheduler always comes with error popups for many tasks. "Task X: The task object version is either unsupported or invalid." After closing all of them, I can get into Task Scheduler but I...
Performance & Maintenance
Solved Time Zone change causes error in Task Scheduler for every task
My issue is kind of strange. I am an insider currently on Windows 10 build 10240. All the build I have tried so far has this same error in task scheduler when I change my time zone to my current location which is kathmandu (UTC+5:45). When i change...
Performance & Maintenance
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 04:45.
Find Us
Twitter Facebook Google+

Windows 10 Forums