Skip to content

Instantly share code, notes, and snippets.

@kntjspr
Created February 11, 2026 16:23
Show Gist options
  • Select an option

  • Save kntjspr/404d369a4cd1dfca4dff8ce673461576 to your computer and use it in GitHub Desktop.

Select an option

Save kntjspr/404d369a4cd1dfca4dff8ce673461576 to your computer and use it in GitHub Desktop.
rdp session disconnect for pyautogui
for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
%windir%\System32\tscon.exe %%s /dest:console )
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment