How do you create shortcuts for task schedule triggers?


Sammy888

Well-known member
Member
VIP
Local time
11:53 AM
Posts
364
OS
Windows 11
I have a trigger called NetDisable located in a new task folder called UC.

I tried: C:\Windows\System32\schtasks.exe /run /tn "NetDisable"

I tried: C:\Windows\System32\schtasks.exe /run /tn "UC\NetDisable".

None of the above worked.

However, I was successful only from the cmd prompt when I manually copy and paste the following: schtasks /run /TN “UC\NetDisable"

I would like to automate this process, if possible?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo
    Graphics Card(s)
    NVIDA 1650 Ti
    Monitor(s) Displays
    Lenovo C32q-20
If I'm understanding what you want correctly, what you need is a batch file that will run the command and I am not very good at that, but there are numerous people on this forum who are. You can save the file to your desktop and click on it any time you want it to run.
If no one answers you soon, change the title of your post to "Need batch file to run task". I believe that will get their attention.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2 2600.1742
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 7080
    CPU
    i9-10900 10 core 20 threads
    Motherboard
    DELL 0J37VM
    Memory
    32 gb
    Graphics Card(s)
    none-Intel UHD Graphics 630
    Sound Card
    Integrated Realtek
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    1tb Solidigm m.2 nvme+256gb SKHynix m.2 nvme /External +512gb Samsung m.2 sata+1tb Kingston m2.nvme
    PSU
    500w
    Case
    MT
    Cooling
    Dell Premium
    Keyboard
    Logitech wired
    Mouse
    Logitech wireless
    Internet Speed
    so slow I'm too embarrassed to tell
    Browser
    Firefox
    Antivirus
    Defender+MWB Premium
  • Operating System
    Windows 10 Pro 22H2 19045.3930
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 9020
    CPU
    i7-4770
    Memory
    24 gb
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    256 gb Toshiba BG4 M.2 NVE SSB and 1 tb hdd
    PSU
    500w
    Case
    MT
    Cooling
    Dell factory
    Mouse
    Logitech wireless
    Keyboard
    Logitech wired
    Internet Speed
    still not telling
    Browser
    Firefox
    Antivirus
    Defender+MWB Premium
If I'm understanding what you want correctly, what you need is a batch file that will run the command and I am not very good at that, but there are numerous people on this forum who are. You can save the file to your desktop and click on it any time you want it to run.
If no one answers you soon, change the title of your post to "Need batch file to run task". I believe that will get their attention.
Hi. Thanks. Yes, that's what I'm looking for. I tried to create one, but nothing seems to work though outside the command prompt.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo
    Graphics Card(s)
    NVIDA 1650 Ti
    Monitor(s) Displays
    Lenovo C32q-20
Sammy,

If you manually create a shortcut then you can put this in its Target field
C:\Windows\System32\schtasks.exe /Run /TN "UC\NetDisable"
or
schtasks.exe /Run /TN "UC\NetDisable"

I have no idea why your second example would not run. It appears to me to be correct.

I use shortcuts of this type and have not had any problems.

Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3447
Sammy,

If you manually create a shortcut then you can put this in its Target field
C:\Windows\System32\schtasks.exe /Run /TN "UC\NetDisable"
or
schtasks.exe /Run /TN "UC\NetDisable"

I have no idea why your second example would not run. It appears to me to be correct.

I use shortcuts of this type and have not had any problems.

Denis
Thanks. I know. I see no reason why it shouldn't run but it doesn't. The screen quickly flickers and nothing happens. Whereas if I copy and past the command in the command bar, it works fine.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo
    Graphics Card(s)
    NVIDA 1650 Ti
    Monitor(s) Displays
    Lenovo C32q-20
Sammy,

Does Task scheduler, Task history tell you anything useful?

Perhaps you could create a dummy task [such as running Notepad] in the same UC folder to use to test that the syntax & all functions are working correctly so you can then amend it to include the real Action.
That might help to identify where the problem is happening.

Best of luck,
Denis
 

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3447
Not alone in this. I've got an identical issue where the shortcut doesn't work, run as admin, etc. I'm also not having any luck with the .bat file approach either. But run from an administrative cmd shell it's fine, just like above. So no shortcut, no batch, no luck. Windows 11 machine 22H2. Putting pieces together for the next universal image (and migration to 11) and not enjoying many oldie-but-goodie tricks falling by the wayside without simple alternatives.

Interesting twist, if you construct a .ps1 with Start-ScheduledTask -TaskName "ScanSoftware" and run a shortcut to that, or rather the PowerShell executable and call it with -File, you can run it as an admin and start the task with a shortcut. It's a bit circuitous compared to the good ol' way, but it gets the job done.
 

My Computer

System One

  • OS
    Windows 11
Sammy,

Does Task scheduler, Task history tell you anything useful?

Perhaps you could create a dummy task [such as running Notepad] in the same UC folder to use to test that the syntax & all functions are working correctly so you can then amend it to include the real Action.
That might help to identify where the problem is happening.

Best of luck,
Denis
Hi, sorry for the late reply.

It doesn't.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Lenovo
    Graphics Card(s)
    NVIDA 1650 Ti
    Monitor(s) Displays
    Lenovo C32q-20
Try this in the shortcut Target field
schtasks.exe /run /tn "\UC\NetDisable"

I could not find any of my own old examples so I rechecked the built in help
SchTasks /Run /?
and we were both forgetting that a leading \ is needed before the task's folder name. I don't remember having to do that.

I just set up a dummy task in a TS subfolder and the revised syntax worked both in a cmd prompt and as the Target field of a shortcut.
schtasks.exe /run /tn "\Event Viewer Tasks\dummy"


Ignore me.
I just set up a dummy task in a TS subfolder and the original syntax worked both in a cmd prompt and as the Target field of a shortcut.
schtasks.exe /run /tn "Event Viewer Tasks\dummy"
so the change I suggested above is not necessary - it worked both with & without the leading \.

I suggest you do what I suggested all that time ago. Create a dummy task in your TS sub-folder. Just make it run the command
notepad
and see if that runs from your shortcut to it.


Denis
 
Last edited:

My Computer

System One

  • OS
    Windows 11 Home x64 Version 23H2 Build 22631.3447

Latest Support Threads

Back
Top Bottom