Skip to content

Instantly share code, notes, and snippets.

@tknhs
Created September 19, 2022 04:21
Show Gist options
  • Save tknhs/449ae1ef10cfce363093b0df561fabae to your computer and use it in GitHub Desktop.
Save tknhs/449ae1ef10cfce363093b0df561fabae to your computer and use it in GitHub Desktop.
セッションを別ユーザに渡す
@echo off
setlocal enabledelayedexpansion
cd %~dp0
for /f "usebackq tokens=4*" %%a in (`tasklist /v ^| findstr RDP`) do (
set SessionNumber=%%a
)
tscon !SessionNumber! /dest:console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment