Task Scheduler not running bat files
Page 1 of 2 12 LastLast
Results 1 to 15 of 24

Thread: Task Scheduler not running bat files

  1. #1
    Join Date
    Sep 2000
    Location
    Allen, TX, US
    Posts
    389

    Task Scheduler not running bat files

    I have had several bat files that used to run at certain times throughout the day, but despite the status showing as Ready, they don't run anymore. If I right click and tell it to run, nothing happens. If I run the file manually, they work fine.

    The script is using wscript.exe
    Arguments: C:\xcopy backups\Batch files\Scripts\BatchLauncher.vbs" "C:\xcopy backups\Batch files\Copy_CR.bat"
    Start in: C:\xcopy backups\Batch files\

    Any suggestions?

    KZ

  2. #2
    Join Date
    Feb 2000
    Location
    Idaho Falls, Idaho, USA
    Posts
    18,063
    What version of Windows are you using?

    Is the Task Scheduler Service running?

  3. #3
    Join Date
    Sep 2000
    Location
    Allen, TX, US
    Posts
    389
    Windows 7 Home Premium SP1

    Yes, the scheduler is running.

  4. #4
    Join Date
    Mar 2009
    Location
    Arkham Asylum, Cell 13
    Posts
    11,686
    It's better to NOT use spaces in folder names. I'd at least use underscores. xcopy_backups vs. xcopy backups.

    Try adding double quotes around all paths.

    Arguments: "C:\xcopy backups\Batch files\Scripts\BatchLauncher.vbs" "C:\xcopy backups\Batch files\Copy_CR.bat"
    Start in: "C:\xcopy backups\Batch files\"

  5. #5
    Join Date
    Sep 2000
    Location
    Allen, TX, US
    Posts
    389
    Thank you! I'll work on that and see how that goes!

    BTW, I'll be out for a few days, so if I don't respond, I haven't forgotten....

  6. #6
    Join Date
    Sep 2000
    Location
    Allen, TX, US
    Posts
    389
    It still does not work. Any other suggestions?

  7. #7
    Join Date
    Mar 2009
    Location
    Arkham Asylum, Cell 13
    Posts
    11,686
    So the job was working in Task Scheduler, and then it just stopped working?

    If I run the file manually, they work fine.
    How exactly are you running these files manually? Are you opening a command prompt and running
    wscript.exe C:\xcopy backups\Batch files\Scripts\BatchLauncher.vbs" "C:\xcopy backups\Batch files\Copy_CR.bat"

    What path are you using to wscript.exe? It should be in C:\Windows\System32

  8. #8
    Join Date
    Sep 2000
    Location
    Allen, TX, US
    Posts
    389
    Yes, it had been working, but stopped some time ago.
    I can run them manually from my batch file folder by just double-clicking on them.

    I'm using wscript. I'm not sure where it's pointing to because that is the only text that is in the exe path. Do you think I need to re-setup the exe path?
    All the directories now have complete folder and file names without spaces, but that didn't change anything...although a good idea.

  9. #9
    Join Date
    Mar 2009
    Location
    Arkham Asylum, Cell 13
    Posts
    11,686
    I can run them manually from my batch file folder by just double-clicking on them.
    That's not the same thing. You're not running the same full command path.

    Did you set up the task scheduler job? Unless you set the path variable, you need to set the full path of the .exe.

  10. #10
    Join Date
    Sep 2000
    Location
    Allen, TX, US
    Posts
    389
    Is this file required in the "Add arguments" section?
    "C:\xcopy_backups\Batch_files\Scripts\BatchLauncher.vbs"

    I did notice this evening that several of the scripts show "The system cannot find the path specified" and "The directory name mis invalid." Not sure what's up with that. Wondering if it's the vbs file. In the arguments section I have the BatchLauncher followed by the bat file name.

  11. #11
    Join Date
    Mar 2009
    Location
    Arkham Asylum, Cell 13
    Posts
    11,686
    Is this file required in the "Add arguments" section?
    "C:\xcopy_backups\Batch_files\Scripts\BatchLauncher.vbs"
    Didn't you write those scripts? What are you trying to do exactly?

    That's why I asked if you tested the command from a command prompt. If it doesn't work there, it probably won't work in Task Scheduler.

    Normally, you'd use wscript.exe to run one script. I'm not sure how your .vbs works with the .bat file.

  12. #12
    Join Date
    Sep 2000
    Location
    Allen, TX, US
    Posts
    389
    Yes, I did write those bat scripts. They work perfectly from a command prompt.
    Someone on this forum a long time ago had me put that vbs in there. I'll have to research that.

  13. #13
    Join Date
    Sep 2000
    Location
    Allen, TX, US
    Posts
    389
    Hi all. I'm finally getting back to this incomplete task....

    My batch files run perfectly from a cmd prompt or by double-clicking them.

    I have the Action Program/script set to "C:\Windows\System32\wscript.exe" and the Add aurguments to "C:\xcopy_backups\Batch_files\Copy_CR_to_NES.bat"

    When I right-click on it to tell it to Run, I get an error popup that says "There is no script engine for file extension '.bat".

    What am I doing wrong?

  14. #14
    Join Date
    Mar 2009
    Location
    Arkham Asylum, Cell 13
    Posts
    11,686
    It's hard to remember when you don't post back for 3 months.

    I found this error about cscript, but I'm assuming it's similar for wscript:
    https://social.technet.microsoft.com...=winservercore

    Regarding this error message, well, this is expected behavior as I noticed that you put both 'cscript' and '.bat' in this command. Cscript.exe does not work with '.bat' files, it supports VBScript (.vbs) and Jscript (.js). Please take a look at the following article for some general information:

    http://technet.microsoft.com/en-us/l.../bb490887.aspx

    So, as a workaround, you can either remove the 'cscript' character or, change the batch file to VBScript.
    I don't really know VBScript, so someone else would need to help you with that.

  15. #15
    Join Date
    Feb 2000
    Location
    Idaho Falls, Idaho, USA
    Posts
    18,063
    wscript.exe / VBScript is not needed to run a .bat batch file.

    Possibly useful Link:

    https://www.thewindowsclub.com/how-t...ally-windows-7

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •