Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a batch file daily.bat, this is the code:

cd C:\inetpub\wwwroot\infoweb\factuur\cron

c:\PHP\php.exe -f ./cron_pdf.php

ftp -s:ftp_upload.txt ftp.infoweb.be

And I created a task with task scheduler in windows 7. When I run the batch manually, everything goes fine, but when I try to run it with the task scheduler nothing happens.

My action is 'run script' "C:\inetpub\wwwroot\infoweb\factuur\cron\daily.bat"

UAC is off and I am Admin.

Any idea why this is not working?

Thanks

share|improve this question

migrated from serverfault.com Dec 14 '10 at 10:27

This question came from our site for professional system and network administrators.

    
This is a better fit for super user - it should get transferred there automatically. –  Iain Dec 14 '10 at 9:50

3 Answers 3

up vote 1 down vote accepted

ok it is working now this is what I did, you probably won't need all these steps to make it work but just to be sure try them all:

  • Check the account parameters of your scheduled task and make sure they are set to run whether or not someone is logged into the machine

  • check run with most privileges/rights

  • Make sure you go to the full path first: cd C:\inetpub\wwwroot\infoweb\factuur\cron

  • Don't use double quotes in your batch files (don't know why but seems to help)

  • Be super admin, enter 'Net user administrator /active:yes' in command prompt, log out and log in as the super admin, so UAC is off

Thanks guys

share|improve this answer

Check the account parameters of your scheduled task and make sure they are set to run whether or not someone is logged into the machine and the password is saved

share|improve this answer
    
thanks but I already did that, and I also checked run with most privileges/rights –  Ruben Dec 14 '10 at 9:52

I was having troubles with running a batch file which does compress all files in a folder, moves the compressed files away and deletes the original files. It was working on W2K3 but on W2K8R2 it didn't work anymore - got success when running the batch but nothing helped.

I followed all suggestions from Ruben but no joy.

After some time I found the problem: On W2K3 the batch file was run in the directory where the batch file resided whilst on 2K8 it opens cmd with default path. So I had to explicitly cd to the corresponding drive + directory in order for it to run.

share|improve this answer
2  
great, I think this is what I meant with 'Make sure you go to the full path first', windows batch files can be a pain in the ass –  Ruben Jul 11 '13 at 13:40

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.