When I create a profile to run a cmd with psexec as SYSTEM, the cursor shows up in wrong place #22321

Closed
opened 2026-01-31 08:09:45 +00:00 by claunia · 1 comment
Owner

Originally created by @amithegde on GitHub (Sep 27, 2024).

Windows Terminal version

1.22.2362.0

Windows build number

10.0.26100.1742

Other Software

psexec latest version

Steps to reproduce

  • Create a profile like this:

{ "guid": "{8b2b34e0-bd6b-4f2c-a653-e59f87c30488}", "name": "CMD as SYSTEM", "commandline": "Q:\\Tools\\SysinternalsSuite\\PsExec.exe -s cmd.exe", "startingDirectory": "%USERPROFILE%", "hidden": false },

  • open the new profile

Be sure to update psexec location after downloading https://learn.microsoft.com/en-us/sysinternals/downloads/psexec

Expected Behavior

Commandline should behave normally

Actual Behavior

The cursor shows up few lines above at the beginning instead of showing up at the correct prompt line

like this
image

Originally created by @amithegde on GitHub (Sep 27, 2024). ### Windows Terminal version 1.22.2362.0 ### Windows build number 10.0.26100.1742 ### Other Software psexec latest version ### Steps to reproduce + Create a profile like this: `{ "guid": "{8b2b34e0-bd6b-4f2c-a653-e59f87c30488}", "name": "CMD as SYSTEM", "commandline": "Q:\\Tools\\SysinternalsSuite\\PsExec.exe -s cmd.exe", "startingDirectory": "%USERPROFILE%", "hidden": false },` + open the new profile Be sure to update psexec location after downloading https://learn.microsoft.com/en-us/sysinternals/downloads/psexec ### Expected Behavior Commandline should behave normally ### Actual Behavior The cursor shows up few lines above at the beginning instead of showing up at the correct prompt line like this ![image](https://github.com/user-attachments/assets/bfd1ec61-01e1-468d-9ef5-b542d6561f4c)
claunia added the Needs-TriageIssue-BugNeeds-Author-Feedback labels 2026-01-31 08:09:45 +00:00
Author
Owner

@DHowett commented on GitHub (Sep 27, 2024):

FWIW, I think this is because CMD is reattaching to the console owned by psexec, which it is not allowed to do.

The docs for psexec explain that -i is required for console applications.

arg desc
-i Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session. This flag is required when attempting to run console applications interactively (with redirected standard IO).

emphasis original; I did not add it


PsExec is not intended to be used to connect one console application to another console application's session.

@DHowett commented on GitHub (Sep 27, 2024): FWIW, I think this is because CMD is reattaching to the console owned by psexec, which it is not allowed to do. The [docs for `psexec`](https://learn.microsoft.com/en-us/sysinternals/downloads/psexec#using-psexec) explain that `-i` is _required_ for console applications. > arg | desc > -- | -- > `-i` | Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session. This flag is **required** when attempting to run console applications interactively (with redirected standard IO). _emphasis original; I did not add it_ --- PsExec is not intended to be used to connect one console application to another console application's session.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22321