Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Task Scheduler Windows 7 task that invokes firefox.exe on a URL which is an iMacro. Upon completion, the firefox window is left open. I always have firefox running, but it brings up a new window, not sure if this is a new instance of firefox, or a second window. Upon completion of the macro, I'd like the extra window closed. The extra window has a blank tab and a tab for the macro that ran.

How can I set up the task to clean up after itself?

share|improve this question
up vote 1 down vote accepted

This needs to be supported by Firefox, or the web page needs to use JavaScript to close the browser window after it's completed.

Do look into the command-line switches though, because the "-remote" switch may let you specify a JavaScript command that can delay then close the window for you. You'll have to do some research into this though, and one helpful starting point may be this web page:

I hope that helps.

share|improve this answer

Probably you know how much time you need for this task to run.
It's possible to set a time for the task to finish.
If you do this when that time is out, all opened application's instances by that task will be killed. So, if you think that one minute is enough, to complete the task, you should use something like 2 or 3 minutes to force those instances to close Firefox. Even if you choose the task to repeat every 1 minute (YES, it's possible to overwrite any number in any possible options time), it won't have more than 2 or 3 Firefox opened windows, for as long as you combine repeating and Stoping task.

I really hope this is a general good help for everyone who uses lots of Scheduled Tasks.

share|improve this answer

Your Answer


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.