My schtasks don't schedule anything. :( - windows

I'm trying to make a scheduled task, and its just not working for me.
This is the command I type in CMD:
schtasks /create /sc minute /mo 1 /tn test /tr calc.exe /st 19:17:00 /sd 12/14/2009
I'm trying to tell the computer to run calculator every minute starting at 7:09 PM. Although I get a success message after I type this in and hit enter, nothing happens at 7:09. What gives?
Thanks in advance.

Thank you popester, for the first time I get run a task using command line parameters. Waffles, my task has been created however, it also didn't run. So I added some parametters and now it works. Try:
schtasks /create /th test2 /tr "c:\temp\run.bat" /sc daily /st 18:10:00 /ru SRVIMG\Administrator /rp XXXXXXX
Where XXXXXXX is my administrator password

/st wants HH:mm, not HH:mm:ss. The following works for me on Windows 7:
schtasks /create /sc minute /mo 1 /tn test /tr calc.exe /st 14:43 /sd 12/15/2009
Doc:
/ST starttime Specifies the start time to run the task. The time
format is HH:mm (24 hour time) for example, 14:30 for
2:30 PM. Defaults to current time if /ST is not
specified. This option is required with /SC ONCE.

make sure that your task scheduler service is running as well. check in your "control panel" under "services"

Related

Scheduled Task gets removed upon reboot

I'm trying to make a scheduled task for a small software I had written for a friend,
I'm using
Schtasks /create /SC MINUTE /MO 30 /tn JoesInventoryReader /tr C:\joes.exe /RL HIGHEST
But for some reason, whenever we reboot the computer, this task is removed.
I was reading all of Schtasks parameters and none mentioned anything related to automatic removal.
Help? I've been trying to fix that for over an hour.
Thanks in advance everyone
Your task is triggered once and then runs repeatedly.
If you want to execute the program regularly, you should use /SC DAILY (or weekly, monthly) or /SC ONLOGON.
Use /RI to define the repetition and /DU to define the length of the repetition:
Schtasks /create /SC DAILY /RI 30 /DU 24:00 /tn JoesInventoryReader /tr C:\joes.exe /RL HIGHEST

Onidle task starting after specific date

I'm trying to create a batch file that will (among other things) create task for Windows Task Scheduler that should be executed every time computer goes idle for some time but should start executing that task only after the specific date.
When I tried to write it like that
schtasks /create /TN "Connection Configuration" /SC onidle /i 5 /sd 12/13/2018 /tr "C:\Program Files\OpenVPN\config\client.bat"
I get the error message telling that /SD parameter can't be used with onidle.
Is there any other way to do that on Windows 10 Pro?
You are missing /create parameter.
This works for me:
schtasks /create /tn test123 /sc onidle /i 1 /sd 09/12/2018 /tr "cmd /c mkdir test123"
/sd can be used but /st cannot.
If this is not enough, export the task as XML, modify it, and then import with
schtasks /create /xml c:\path\to\file.xml /tn INSERT_TASKNAME_HERE

Windows use Schtasks to run a task once after two months from now

I want to create a task to delete a file after 2 months from the current date. How can I do this?
EDIT -------
I was able to find how to create a task that runs once
schtasks /create /tn "My App" /tr c:\apps\myapp.exe /sc once /sd 01/01/2003 /st 00:00
But how can I set the sd date to current date + 2 months thanks
schtasks /CREATE /SC ONCE /TN 'My App' /TR 'powershell.exe Remove-Item -Path "c:\apps\myapp.exe" -Confirm:$false -Force' /SD (get-date).AddMonths(2).ToString('MM/dd/yyyy') /ST (get-date).ToString('HH:mm')
Run this in powershell. It will "calculate" the current time and add two months. In the last few months I have googled how to do this for my project. I hope this will help you too. Its going to do this only ONCE after two months after you run this. I hope you can adjust the task as you wish from here.

How to change start directory of an scheduled task with schtasks.exe in Windows programatically?

I am trying to schedule a task with this command
SCHTASKS /Create /TN MyTaks /SC minute /MO 1 /TR "%cd%\myfile.exe"
I need Task Scheduler run my file inside current directory of myfile.exe.
How this can be done considering that I tested this command also.
SCHTASKS /Create /TN MyTaks /SC minute /MO 1 /TR "\%cd%"%cd%\myfile.exe"
I solved it with adding /V1
SCHTASKS /Create /V1 /TN MyTask /SC minute /MO 1 /TR "%cd%\myfile.exe"

Windows 7 Scheduled task command line

This command should create a task that every minute runs the calculator windows application.
schtasks /Create /tn "mytask" /sc MINUTE /mo 1 /ru "myuser" /rp "mypassword" /tr "C:\Windows\System32\calc.exe"
It runs OK, the tasks gets added. The task looks right. The tasks shows as started in the schedular but the calculator does not get fired up. The exe exists, I can run it separately.
Anyone know why I don't see the calculator?
How to Create, Modify and Delete Scheduled Tasks from the Command Line
Windows XP/Server 2003 introduced us to the SchTasks command line tool which usurped the At tool offered in Windows 2000. This tool offers the ability to control every aspect of your Scheduled Tasks through calls to this command.
While the wizard Windows uses to help you graphically create Scheduled Tasks is very good, the command line tool is ideal for situations such as:
Manipulate tasks in batch scripts.
Control and create tasks on networked machines without having to login to them.
Mass create/sync task across multiple machines.
Use in custom applications to communicate with the Task Scheduler instead of having to make API calls.
Eg:
Create ‘My Task’ to run C:RunMe.bat at 9 AM everyday:
SchTasks /Create /SC DAILY /TN “My Task” /TR “C:RunMe.bat” /ST 09:00
Modify ‘My Task’ to run at 2 PM:
SchTasks /Change /TN “My Task” /ST 14:00
Create ‘My Task’ to run C:RunMe.bat on the first of every month:
SchTasks /Create /SC MONTHLY /D 1 /TN “My Task” /TR “C:RunMe.bat” /ST 14:00
Create ‘My Task’ to run C:RunMe.bat every weekday at 2 PM:
SchTasks /Create /SC WEEKLY /D MON,TUE,WED,THU,FRI /TN “My Task” /TR “C:RunMe.bat” /ST 14:00
Delete the task named ‘My Task’:
SchTasks /Delete /TN “My Task”
Probably because the task isn't running interactively. Add the '/it' option:
/IT
A value that enables the task to run interactively only if the
/RU user is currently logged on at the time the task runs. The task
runs only if the user is logged on.
Without the /it option, tasks run in session 0, which doesn't allow interaction with the user. For more information, do a web search for "Session 0 isolation".

Resources