Windows Terminal window shows up when running a task via schtasks.exe when WT is set as default terminal #20412

Open
opened 2026-01-31 07:13:00 +00:00 by claunia · 0 comments
Owner

Originally created by @supra107 on GitHub (Aug 28, 2023).

Windows Terminal version

1.17.11461.0

Windows build number

10.0.19045.3324

Other Software

schtasks.exe
Windows Task Scheduler

Steps to reproduce

Run a Task Scheduler task via "schtasks /run /tn" command while Windows Terminal is set as the default terminal. In this case it's a simple task that runs a file manager .exe in elevated mode.

Expected Behavior

The program opens up instantly without any terminal windows showing up as is the default behavior when Windows decides on the default terminal program. No additional delay appears between executing the task and the program opening.

Actual Behavior

For a brief moment Windows Terminal shows up causing a slight delay between the task being ran and the program opening caused by Windows Terminal unnecessarily loading when the task is executed.

This is noticeable as in my case I'm using a macro to quickly switch between an elevated and unelevated instance of a program by running a task in Task Scheduler that opens the program in elevated mode without a UAC prompt. However the Windows Terminal window also shows up when the task runs without elevation.

By swapping the default terminal back to Windows default the elevated and unelevated version opens up in the same time, while with the default terminal set as Windows Terminal, it briefly opens up when the Task Scheduler task is executed, leading to the elevated process opening slower than the unelevated version which is ran directly from the executable.

This is unexpected behavior as I am not executing a Batch script via Task Scheduler, but an exectuable file directly, and it's not an issue when Windows Terminal is not the default terminal. Windows Terminal shouldn't be invoked when running tasks from Task Scheduler that don't explicitly invoke the terminal.

I've verified that the issue is within the schtasks command, the AutoHotkey macro behaves the exact same as a desktop shortcut.

Originally created by @supra107 on GitHub (Aug 28, 2023). ### Windows Terminal version 1.17.11461.0 ### Windows build number 10.0.19045.3324 ### Other Software schtasks.exe Windows Task Scheduler ### Steps to reproduce Run a Task Scheduler task via "schtasks /run /tn" command while Windows Terminal is set as the default terminal. In this case it's a simple task that runs a file manager .exe in elevated mode. ### Expected Behavior The program opens up instantly without any terminal windows showing up as is the default behavior when Windows decides on the default terminal program. No additional delay appears between executing the task and the program opening. ### Actual Behavior For a brief moment Windows Terminal shows up causing a slight delay between the task being ran and the program opening caused by Windows Terminal unnecessarily loading when the task is executed. This is noticeable as in my case I'm using a macro to quickly switch between an elevated and unelevated instance of a program by running a task in Task Scheduler that opens the program in elevated mode without a UAC prompt. However the Windows Terminal window also shows up when the task runs without elevation. By swapping the default terminal back to Windows default the elevated and unelevated version opens up in the same time, while with the default terminal set as Windows Terminal, it briefly opens up when the Task Scheduler task is executed, leading to the elevated process opening slower than the unelevated version which is ran directly from the executable. This is unexpected behavior as I am not executing a Batch script via Task Scheduler, but an exectuable file directly, and it's not an issue when Windows Terminal is not the default terminal. Windows Terminal shouldn't be invoked when running tasks from Task Scheduler that don't explicitly invoke the terminal. I've verified that the issue is within the schtasks command, the AutoHotkey macro behaves the exact same as a desktop shortcut.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20412