I've created 2 tasks in Task Scheduler on my Vista PC start uTorrent at 2am then close uTorrent (and shutdown PC) at 7am. However i'd like to only like this task to run if I've clicked a shortcut - ideally show something in the tray as well if possible. But not sure how?
Thanks in advance!
I managed to to something like this myself in windows 7, should be the same in Vista.
To do what you want you could create a scheduled task that starts utorrent, another to close it later and another to then shut down the pc, all timed to run every day at 2am. You would then create a task that runs a batch file to delete the other tasks every time you boot up.
You will have exported the first three tasks as XML files just after you created them and saved them somewhere.
The key is that you then create a batch file that, upon double clicking will create the scheduled tasks by importing the XML files. This will cause the tasks to run as before and shut down your pc afterwards. Next time you boot up your machine the tasks are deleted again by the first batch file.
Read up on batch files (simple command propt commands in a file that run when clicked) and the command-line interface for scheduled tasks.
Type schtasks /? at the command promt for more info.
Hope that makes sense.
Related
I have a bat file which I run with an externally given parameter. It should run for about 6 hours and if the task is still not finished, the process should get killed. I can start the task using Task Scheduler but I'm not sure how to kill it once it reaches the set number of hours. Any idea how I can achieve this?
Thanks.
In Windows Task Scheduler use "Create Task" (not "Create Basic Task").
On the Settings screen there is the option labelled "Stop the task if it runs longer than:".
You can override the length of time.
I have a batch file that toggles aero. Is there a way that when you open a certain program the batch file will run when it is launched and run again when the program is closed?
Well yes, but on the Properties for the program you can tick a checkbox to do this on the compatability tab.
Find out info on what the browser is doing. Sart your program and then use Task manager to find your game (it is a real game and not some jscript web thing?).
Compatability layers are scritable.
See http://support.microsoft.com/kb/286705
set __compatlayer=256Color (note wrong spelling)
Running a program will have same problem as setting compatability. You have to find something to run it on.
Windows can start a debugger automatically when a program is started. You can substitute any program that can start a program (as a batch can) for the debugger.
You can also run a script that triggers on program start. Task Scheduler can run tasks when certain events occur.
But you have to know what exact object to trap. Use task manager in the first instance.
I'm creating a simple job that I'd like to run every 60 seconds (1 minute). Instead of approaching this using a Windows Service Installer program, I'd like to create a Console App that is run through Windows Scheduler.
What will happen if a job kicks off and it takes more than 60 seconds to process? Will a second instance of a job kick off again? I'd like Windows to manage the job in a manner such that a second instance of a job won't kick off until the first one is complete.
Does this make sense? Will the Windows Task Scheduler use this approach by default?
Thanks all.
Yes, Windows will start a new instance by default; however, you can control that behavior. In Control Panel, go to Task Scheduler. Find any time-scheduled task and right click/Properties, then choose the Settings tab. At the bottom, you'll see an option named "If the task is already running, then the following rule applies." You can choose to not start a new instance, run a new instance in parallel, queue a new instance, or stop the existing instance. You want the first choice. The Windows Task Scheduler API provides the same functionality.
I have 2 batch files as "actions" in a single task. The first one does a scan for viruses using microsoft security essentials. The second one puts the computer to sleep. The problem is that when the task is run, it seems like both batch files run simultaneously, that is, I can see the start of the virus scan, but then the computer goes to sleep almost immediately, so the scan really never has a chance to start. I understood that batch files would run in sequential order in the task scheduler. Am I wrong? How do I make the sleep batch file wait until the scan batch file has completed? Here are the 2 simple batch files...
Batch file one
"C:\Program Files\Microsoft Security Essentials\MpCmdRun.exe" -scan -scantype 1
Batch file two
powercfg -h off
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
powercfg -h on
It's possible using Windows Scheduled Tasks for Windows 7, Windows Server 2008 R2, Windows Server 2012, Windows Vista.
From Microsoft documentation:
A task action is the work that is performed when the task is run. A task can have a single action or a maximum of 32 actions. Each action contains settings that determine how the action is performed. A task's actions are displayed on the Actions tab of the Task Properties or Create Task dialog box. When multiple actions are specified, they are executed in sequential order starting with the action at the top of the list in the Actions tab...
I believe the easiest way to fix this is to have the first batch file call the second batch file. Since the commands in batch files are processed sequentially that would fix your problem.
Another way is for the action to contain START /W C:\MyScript.bat The /W is a parameter for the start command to wait for completion before returning control.
I wrote a script in Ruby. I'd like to run it every day at a certain time. How do you do that on a Windows XP system?
I poked around on the machine and discovered the "scheduled tasks" control panel, but it doesn't seem to have anything to do with running scripts, as far as I can tell from the options offered by the "wizard".
Scheduled Tasks. Sometimes, you have to make a batch file call the script, and schedule the batch.
say you have "script.vbs" you want to run, you will have to create this batch:
cscript script.vbs
cscript is the windows script host which interprets the vbs script. I'm sure ruby has something similar.
You can do it with scheduled tasks, just browse for the program or script you want to run if it isn't listed (in this case, the ruby interpreter I guess, and add the name of the script to run as an argument).
Use the Windows task scheduler.
Under Control Panel > Schedule Tasks.
You can set it up to run any application or file executable from the command line.
Update: (1/15/09)
A good point from Wouter van Nifterick, remember to take care that the process finishes before the next one runs (in comments).
This can be done by going into the advanced options and adjust the allowed amount of time the task may run.
If the task is already configured open it and click the Settings tab. At the top of this tab you will see a checkbox followed by 'Stop the task if it runs for:' then there are two text boxes to enter hours and minutes. If your script runs once a day you will want this set to 23 hours or so.
The 'at' command is a nice command line version of a scheduler.