Bat file to end RDP without ending windows session

Hi guys,

I used to have a bat file for when I wanted to disconnect my ec2 vm without interrupting the automation but I lost that file.

Can anyone make a similar bat file for me please ?

Many thanks



Please try this…Paste in notepad and save as .bat file

echo off

tscon %sessionname% /dest:console


What is my session name sir ?

Thank you


Type this in cmd you will get the session name or you can look for it in the task manager

qwinsta /?


Hello sir

I just tried it on my computer, but its a log off and my bot stopped immediately.

Try this solution SOLVED: How To Remotely Log Someone Off – Up & Running Technologies, Tech How To's

logoff <SESSION_ID> /server:<server-host-name>

Check if you installed the unattended robot as stated here Installing the Robot

Also, in Orchestrator, check if your robot has in its settings the LoginToConsole set to No.