Task Scheduler - Win 7 64-bit - problem running .bat file "Hello..."


  1. Posts : 5
    Windows 7 64-bit
       #1

    Task Scheduler - Win 7 64-bit - problem running .bat file "Hello..."


    Hi,

    I'm having a problem trying to automatically run a basic .bat file in task scheduler in windows 7 64-bit.

    I have more complicated .bat files to schedule but I can't get a simple one to run.

    This is the .bat file:

    @ECHO OFF
    ECHO hello there...
    PING 1.1.1.1 -n 1 -w 5000 >NUL

    It works fine manually - it opens a windows and displays the message and then closes after 5 seconds - no problems.

    If I schedule it to automatically run in task scheduler nothing happens - no window appears - but it says its running.

    I did create a .bat file in the same directory containing:

    shutdown /r

    This launched fine using task scheduler - the computer restarted - great.

    Any ideas how to get a simple .bat file to execute in task scheduler other than restarting the computer?

    I'm losing my hair - it shouldn't be this difficult.

    Thanks.
      My Computer


  2. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #2

    Which option do you have selected for your task?
    "Run Only when user is logged on"
    "Run whether user is logged on or not"
    If it's not "Run Only when user is logged on", try using that option.
    If that doesn't help:
    Right click on the Task and click "End" to stop any running tasks.
    Click "Enable all tasks history".
    Right click on the Task and click "Run" to manually run the task.
    See what messages show up in the History tab.
    Are there any error messages?
      My Computer


  3. Posts : 5
    Windows 7 64-bit
    Thread Starter
       #3

    I have selected:

    Run whether user is logged on or not.

    Run with highest privileges.

    I have also disabled UAC completely.

    I even created an .exe file using a macro program to run the .bat file - the .exe file runs fine when I double-click it - windows pops up and disappears as required - but the .exe file does not run either in task scheduler.

    I have played around with the privileges of the file and everything is for Full Control.

    The message shows up as "The operation completed successfully (0x0) - but I never saw the window appear.

    Can anybody try creating a .bat file with the same action and try it on their system?

    This should be basic stuff for a windows machine.

    As I mentioned, I have more complicated .bat files that run great when I double-click them - but I NEED to run them in task scheduler.

    Thanks.
      My Computer


  4. Posts : 5
    Windows 7 64-bit
    Thread Starter
       #4

    History said it returned a code of 0.

    I have another .bat file that sends characters to the serial port - but no characters ever appear to get sent to the serial port - but is the task actually completed if nothing is sent?

    Strange.

    Can anybody else recreate this.

    It does this on two of my machines.
      My Computer


  5. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #5

    Did you try running it with "Run Only when user is logged on" ?

    I have seen where a task runs but no window is displayed.
    That's what it sounds like is happening here.

    When you run the Task do you see cmd.exe and conhost.exe start and end in Task Manager?
      My Computer


  6. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #6

    gigaoops said:
    History said it returned a code of 0.

    I have another .bat file that sends characters to the serial port - but no characters ever appear to get sent to the serial port - but is the task actually completed if nothing is sent?
    In Task Scheduler you can "Display all running Tasks".
    If you have History enabled you should also be able to see if the task completed in the History Tab.
      My Computer


  7. Posts : 5
    Windows 7 64-bit
    Thread Starter
       #7

    I tried a program called Freebyte Task Scheduler.

    It's a free portable program that kinda like the windows program.

    Guess what, the .bat files run fine - the hello .bat file executes when secheduled and the window appears and disappears.

    I'll try it out with my more complicated .bat files.

    Thanks for the info, but I'm just gonna give up on the windows task scheduler.

    Too many headaches.

    As a bonus, the Freebyte lets me easily move the program's schedules from computer to computer.

    Thanks.
      My Computer


  8. Posts : 6,330
    Multi-Boot W7_Pro_x64 W8.1_Pro_x64 W10_Pro_x64 +Linux_VMs +Chromium_VM
       #8

    Cool, glad you found a solution.
    Thanks for that info - I'll have to check it out.
    I know sometimes it's a real pain to get things working with Task Scheduler.
      My Computer


  9. Posts : 5
    Windows 7 64-bit
    Thread Starter
       #9

    Why does Microsoft make Task Scheduler so complicated - it's supposed to be a program to help simplify and automate things for the user?

    Right now it's completely useless to me - I can't remember wasting more time on something that SHOULD have been so simple.

    There doesn't appear to be any logic in how it's implemented in windows 7.

    Thanks to the guys who created the third-party software.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:11.
Find Us