Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Goodmorning everyone, I'm a newbie Windows 2008 s.a., and I'm stuck with a strange problem.

I've made a very simple bat file that stops the Apache HTTP Server, copies a file and then restart the webserver (yes, this is stupid, but this is what they gave to me). Now, the bat runs properly, but if I schedule it, no matter of what privileges I give to the process, it simply doesn't run.

Just to be sure, I've made another script that should create a directory and again it runs normally, but not as a scheduled task.

Where am I wrong? Thank you.

share|improve this question

3 Answers 3

up vote 0 down vote accepted

I solved the matter.

The scripts come from a Windows 2003 Web Edition OS, and they were executed "in the same directory" where they were, seems that in 2008 R2 they're runned in the system32 directory, so I had to use absolute paths.

Everything gone fixed now, thank you for the advices anyway.

share|improve this answer

try to run the batch with error redirecting in task scheduler example.bat 2>>c:\Folder\Errors.txt >>c:\Folder\Run.txt

and change the batchfile, so you get an output everytime (add two lines)

echo %time%
echo %time% >>&2

If you only get one line in both files, your batch has no output, but is running If you get no output in both files, more permissions are needed...

btw did you click on "Run with highest privileges" and "Run whether user is logged on or not" in the task scheduler library?

share|improve this answer

What is the run result in the task scheduler? Does it state (0x0)?

In the action tab what did you enter in "program/script" and what in "arguments" and what in "Start in"?

Usually a batch file should be started using cscript.exe and the file is the argument.

Also, as you are on a Windows 2008 R2 server I would recommend using powershell instead of batchfiles.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.