2

I am trying to use the command line to create a scheduled task that will run after I log into my account, whether it be for the first time on that day, or after resuming from sleep/hibernate and then logging in.

I found the schtasks command, and this looks very much like what I need to run a task after logon: http://technet.microsoft.com/en-us/library/cc772785%28v=ws.10%29.aspx#BKMK_logon

schtasks /create /tn TaskName /tr TaskRun /sc onlogon

After running my command, I can see my task name listed in the scheduled tasks list, but it never runs, regardless of whether I logon from a refresh restart or after resuming from sleep/hibernate. Here is my command:

schtasks /create /tn "AutohotKey Windows Logon Trigger" /tr "calc" /sc ONLOGON

Any ideas?

Thank you for your time.

3
  • @frequency Have you tried the GUI to verify the settings of the task itself?
    – Ramhound
    Commented Jun 28, 2013 at 14:06
  • @Ramhound This scheduled task needs to be created and run by an automated script, so I couldn't use the GUI. Commented Jun 28, 2013 at 14:16
  • I didn't ask you to create it through the GUI I asked you verify the settings for the task itself.
    – Ramhound
    Commented Jun 28, 2013 at 16:01

1 Answer 1

1

For complex tasks it is easier to create the task in the GUI, export it as XML and then on the command line use SCHTASKS /CREATE /tn TaskName /XML xmlfile.

The event triggers in the GUI you likely want are listed as "At log on" and "On workstation unlock".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .