How do you create shortcuts for task schedule triggers?


Sammy888

Member
Local time
3:52 AM
Posts
131
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

glasskuter

Well-known member
Power User
VIP
Local time
5:52 AM
Posts
1,592
Location
The Lone Star State of Texas
OS
Windows 11 Pro 21H2 22000.675
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 21H2 22000.675
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 7080
    CPU
    i9-10900
    Memory
    32 gb
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    256 m.2 2230-256+1 tb hdd
    PSU
    500w
    Case
    MT
    Cooling
    Dell Premium
    Keyboard
    Logitech wired
    Mouse
    Logitech wireless
    Browser
    Firefox
    Antivirus
    Defender+MWB Premium
  • Operating System
    Windows 10 Pro 21H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 9020
    CPU
    i7-4770
    Memory
    24 gb
    Screen Resolution
    2560x1440
    Hard Drives
    256 gb Toshiba BG4 M.2 NVE SSB and 1 tb hdd
    PSU
    500w
    Case
    MT
    Cooling
    standard
    Mouse
    Logitech wireless
    Keyboard
    Logitech wired
    Antivirus
    Defender+MWB Premium

Sammy888

Member
Thread Starter
Local time
3:52 AM
Posts
131
OS
Windows 11
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

Try3

Well-known member
Power User
VIP
Local time
11:52 AM
Posts
521
Location
The proper part of London
OS
Windows 11 Home x64 Version 21H2 Build 22000.675
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 21H2 Build 22000.675

Sammy888

Member
Thread Starter
Local time
3:52 AM
Posts
131
OS
Windows 11
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

Try3

Well-known member
Power User
VIP
Local time
11:52 AM
Posts
521
Location
The proper part of London
OS
Windows 11 Home x64 Version 21H2 Build 22000.675
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 21H2 Build 22000.675
Top Bottom