One of the amazing tool that comes together with Windows is Task Scheduler. By using Task Scheduler, you can schedule the tasks to run daily, weekly, monthly, or at certain times. Although It's easy to configure and create a task, sometime it make you get headache.

Once, I tried to set up the auto upload the file via ftp channel. I created the program and tested it. It's working fine when I run it manually. But It didn't work when I run it by task scheduler. It work perfectly if I choose “Run only when user is logged on”. The problem is that if I choose "Run whether user is logged on or not" option, it cannot run. Then I tested to launch notepad. But cannot be launch. That lead me to go wrong way. Run only when user is logged on I checked everything I may wrong. But everything seen to be correct and I couldn't solve the problem. I googled a lot and tried everything and finally I managed to fix it successfully. I just want to share what I did. If Task Scheduler is not running, you should check following;

  • Check the “Start in (optional) “ If your program path is not one of the system paths. You have better to add you program path in it.
  • If you select the radio button labeled Run whether user is logged on or not. Tasks will not run interactively. ( My problem was in this step as I tried to luanch notepad for testing purpose and it cannot be launch. Because notepad need user action and that lead me to wrong way. )
  • Check all the permission. The user account you setup for your program must have permission not only to run your program itself and but also to run all other program that related to your program. For my example, I called sftp command from insite of my main program. So I need to have permission to run both my main program itself and sftp.exe.

After I fixed all of the above, my program can be run by task scheduler as I expected.

author's photo

Author : Blue Cloud

Just a normal software developer who love to write code. Developing professional software since 1999. After working in the software industry for many years, I've started my own website to share knowledges and experiences.

blog comments powered by Disqus