Windows 7 Tutorial

Automatically run a program or launch / open a file in Windows 7

As we learned in the previous tutorial, Windows 7 allows you to create scheduled tasks with the Task Scheduler, to automatically perform a certain action on your computer; that tutorial gave you just enough to get started, and this tutorial will explain in detail how to open a certain file, open a web page in a specific web browser, and how to run a program or application and "pass arguments" to it.


Automatically open a program in Windows 7, and optionally pass arguments

Follow these steps to automatically run a program (with or without arguments), after you have started creating a scheduled task (see link above).

Tech Tip: if you are using a custom script (a WSH, JS, or VBS file, for example), you may need to pass the script file's path as argument, and use cscript.exe or wscript.exe instead under Program/script. If you have this level of experience with Windows scripting, you will know.

Pass a file as argument to your scheduled task

The previous tutorial focused on the quickest and easiest way to create a scheduled task in Windows 7, and so we simply passed a file name in "Program/script", to skip a step and let Windows define on its own the even handler (your default browser for a URL, your default mail handler for an email, etc.) But using both fields allow you to force Windows 7 to open a certain file type or protocol with an application of your own choosing. Example: if your default browser is Internet Explorer, and you want to automatically open a page in Firefox, just used Firefox as Program, and the URL as argument!

Caveat: don't forget to surround any path under "Program/script" with double-quotes if it contains spaces, otherwise Windows 7 will consider the word(s) following the first space as being arguments onto themselves. (You will get a notice from Task Scheduler if this is the case.)

up ↑
Copyright © 2016 Windows 7 Tutorial. All rights reserved — Sitemap | Disclaimer | Feedback