End RDP Session and Return Session to Physical Console in 8.1 with Batch File

 

One of the things that has bugged me in Windows 8.1 is that the shortcut I had on my main desktop to End RDP and return control to the console:

 

C:\Windows\System32\tscon.exe RDP-Tcp#1 /dest:console

 

stopped working because Window 8.1 increments the session every time you initiate a session. I’ve used this for years, going back multiple operating systems.

This was driving me crazy. Why? Because I’m lazy and if the session isn’t returned to the console, in Windows 8.1, I have to deal with the lock screen and logging on locally. (This is at home, not in an office, where obviously I’d want the computer locked when not sitting at it).

I looked at Power Shell, and didn’t want to deal with the complexity of determining the session ID and generating the right commands. What I came up with was an old fashioned batch file. You can construct this and increment to your heart’s content. It looks like this:

C:\Windows\System32\tscon.exe RDP-Tcp#1 /dest:console
C:\Windows\System32\tscon.exe RDP-Tcp#2 /dest:console
C:\Windows\System32\tscon.exe RDP-Tcp#3 /dest:console
C:\Windows\System32\tscon.exe RDP-Tcp#4 /dest:console
C:\Windows\System32\tscon.exe RDP-Tcp#5 /dest:console
C:\Windows\System32\tscon.exe RDP-Tcp#6 /dest:console
C:\Windows\System32\tscon.exe RDP-Tcp#7 /dest:console
C:\Windows\System32\tscon.exe RDP-Tcp#8 /dest:console
C:\Windows\System32\tscon.exe RDP-Tcp#9 /dest:console
C:\Windows\System32\tscon.exe RDP-Tcp#10 /dest:console

You can keep incrementing to suit your needs. Mine goes up to 60 or so.

Next, place the batch file somewhere on your hard drive (NOT on the desktop itself).

Right click the batch file and select Send To, Desktop (create shortcut)

endrdp 

On your desktop, find the new shortcut and right click and select Properties

Select Advanced

Check Run as administrator and then OK

rdp2

Next (optionally) change the icon to something you will recognize easily by selecting Change Icon.

I selected the icon that was attached to my old, no longer working shortcut

 rdp3

Click OK and you’re done.

rdp4

Now when you RDP in to your desktop, you can double click/tap the icon for the shortcut on your desktop which will run the batch file as administrator and disconnect the session and return control to the console.

Enjoy!