locked
Task Scheduler RRS feed

  • Question

  • Can Task Scheduler run a .bat file, mine does not seem to cooperate

    Please Help

    Monday, July 20, 2015 2:24 PM

Answers

  • Yes it definitely can, I frequently run batchscripts via task scheduler on multiple machines including Windows 7. What happens when you try to run it? What result code does it produce?
    Monday, July 20, 2015 8:12 PM

All replies

  • Yes it definitely can, I frequently run batchscripts via task scheduler on multiple machines including Windows 7. What happens when you try to run it? What result code does it produce?
    Monday, July 20, 2015 8:12 PM
  • Hi there,

    I'm using Windows server 2008 R2 on one of my Pro Env, I have two batch files (See Block code)

    Both should run when the user is logged off however only batch file number 1 is working

    All setting are the same

    any help will be great

    P.S I'm straggling around this issue fora while

    Batch 1:

    set path="C:\Program Files\WinRAR\";%path%

    cd D:\Xsense Services\Protocol\Logs

    winrar a -df -ep -agDD-MMM-YYYY-NN Protocol_.rar -x*.txt

    move *.rar \\xs-nas\Public\XS-App1\PP1

    cd "D:\Xsense Services\ProtocolComm3\Logs"

    winrar a -df -ep -agDD-MMM-YYYY-NN ProtocolComm3_.rar -x*.txt

    move *.rar \\xs-nas\Public\XS-App1\PP3

    cd "D:\Xsense Services\ProtocolZespri\Logs"

    winrar a -df -ep -agDD-MMM-YYYY-NN ProtocolZespri_.rar -x*.txt

    move *.rar \\xs-nas\Public\XS-App1\PP2

    Exit

    Batch 2

    forfiles /p "P:\XS-App1\PP1" /s /m *.rar /c "cmd /c Del @path" -d -90
    forfiles /p "P:\XS-App1\PP2" /s /m *.rar /c "cmd /c Del @path" /d -90
    forfiles /p "P:\XS-App1\PP3" /s /m *.rar /c "cmd /c Del @path" /d -90
    Exit

    Friday, August 21, 2015 7:49 PM
  • 1. High jacking someone else's thread is generally considered rude... and makes it less likely someone will even view your question let alone answer it since the thread is marked as answered.

    2. Your question isn't relevant to Windows 7, so would be better placed either on the Server General forum https://social.technet.microsoft.com/Forums/windows/en-US/home?forum=winservergen or the scripting guys forum https://social.technet.microsoft.com/Forums/windows/en-US/home?forum=ITCG

    3. That said.. try running the second batch script from a cmd prompt and check what is output. Check that it works there, if it does then make that clear when you post to the relevant forum, and if it doesn't then if the output doesn't tell you what the issue is, include what error you get in your posting so others can see it.

    Friday, August 21, 2015 8:47 PM
  • I need a script my be .vbs which runs cmd and execute xcopy command to copy data from one drive to another and I want that .vbs script run by task scheduler on regular intervals
    Saturday, September 1, 2018 7:36 AM