Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 251
  • Last Modified:

Windows Server 2008 - Batch File will not run in Task Scheduler

Hello Experts Exchange
I have a batch file that I'm trying to run in Windows Server 2008 Task Scheduler, in Task Scheduler it report that the task run successfully, but the script should create a log file and no log file is created.

Here is the code I'm trying to run.
@echo off
setlocal

@REM *** START: Turns logging on ***
if "%~1" == "NOWLOGGING" goto NowLogging
    set SchedulesLogFile=%~n0.txt
    %0 "NOWLOGGING" > "%SchedulesLogFile%" 2>&1
    goto :EOF
:NowLogging
@REM *** END: Turns logging on ***


@rem Guts of batch file...
echo [%date% %time%] starting...
echo *** start of actual batch file...
...
echo *** end of actual batch file...
echo [%date% %time%] ending...

Open in new window


How do I resolve the problem?

Regards

SQLSearcher
0
SQLSearcher
Asked:
SQLSearcher
  • 2
  • 2
1 Solution
 
VishalnarseCommented:
Hello,

Please refer the below link for the same.

http://social.technet.microsoft.com/Forums/windowsserver/en-US/d47d116e-10b9-44f0-9a30-7406c86c2fbe/scheduled-task-wont-run-bat-file?forum=winservermanager

Hope this help you if still the issue persist please let me know.

Thank you,
0
 
SQLSearcherAuthor Commented:
Hello Vishalnarse
I have managed to fix it but I now have it stopping on lines of code like this;

"\\fileserver\Graham Rock\T and A\Code\D7aBlue594.vbs"

Open in new window


Its a problem with the " on the line, Task Scheduler can not handle it and there a hot fix, but I can not find the hot fix for windows server 2008.

Are you able to help?

Regards

SQLSearcher
0
 
VishalnarseCommented:
I need some time to investigate this issue... I will find this and update.

Thank you.
0
 
SQLSearcherAuthor Commented:
Thank you for your help.

It looks like I need to install SP2 to the operating system to resolve my second issue.  Awaiting a good time to do so.

Regards

SQLSearcher
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now