Windows Task Scheduler Batch File

Page 1 of 2 12 LastLast

  1. Posts : 6
    New York
       #1

    Windows Task Scheduler Batch File


    Hello:

    I have a Batch File, to move a file to a different folder, that I would like to run from Windows Task Scheduler on a windows server 2008 R2 . The batch file itself works, however running it from Windows Task Scheduler does not work. I am trying to move the file within the L drive.

    I tried entering in Program/Script box: cmd
    and in the add arguments: /c start "" "C:\Users\Administrator\Desktop\Test.bat"

    But no luck. Any Idea why.

    Thanks much!

    Shloma
      My Computer


  2. Posts : 239
    Windows 7
       #2

    This is genuinely a wild guess and I could be entirely wrong but, could it be that the L drive hasn't entirely initialized yet on startup? Perhaps the script is being run too soon?
      My Computer


  3. Posts : 6
    New York
    Thread Starter
       #3

    The first line of the batch file is: L:
    and on the 2th line I start the move statment. This should initialise the L drive. and it does work when runing the batch file.

    Thanks YISMM!
      My Computer


  4. Posts : 239
    Windows 7
       #4

    The first line in the script does not initialize the drive. That simply tells the command prompt you want access to the L drive. Not the same thing. What I'm saying is, perhaps Windows hasn't attached the drive before the script is being initiated. Have you checked the Event Viewer to see if there are any errors? I'm assuming no errors are popping up on your screen either when the script is being initiated? Anyway, I'll let someone else chime in with more experience.
      My Computer


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

    In Task Scheduler click Enable All Tasks History in the right pane
    Run the task
    Look in the Task History tab and see if there are any error messages that might help
      My Computer


  6. Posts : 1,049
    Windows 7 Pro 32
       #6

    Try and add this new line as the first line in the batch file, so you can verify if it starts or not:
    pause

    If you suspect the cmd window isn't even started from task scheduler try and change cmd to c:\windows\system32\cmd.exe
    You could also try without start ""
      My Computer


  7. Posts : 6
    New York
    Thread Starter
       #7

    History shows Task Completed. Looks like batch file does not start, since nothing opens after I added the pause even with adding the path for cmd. Removing the start" " causes the task manager to continue running with no luck.

    Thank you so much for all of your help and guidance, hope you will come up with the bug soon.

    Shloma
      My Computer


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

    I'm not sure i understand how you're trying to run the bat file ???

    When i setup a scheduled task to run a bat file, i just run the bat file like this:

    Windows Task Scheduler Batch File-taskschedbat_01.png
      My Computer


  9. Posts : 6
    New York
    Thread Starter
       #9

    This will not work, because the batch file will not run in cmd.
      My Computer


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

    I don't understand.
    For me, the bat file opens a cmd window.
    If you post screen prints showing what you see it might help.
    Screenshots and Files - Upload and Post in Seven Forums

    I just created a simple bat file to do a dir cmd, and pause.
    Code:
    dir
    
    pause
    Here is what i see when i run it as a scheduled task:
    Windows Task Scheduler Batch File-taskschedbat_02.png
      My Computer


 
Page 1 of 2 12 LastLast

  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 02:06.
Find Us