RDP logout using bat file

0

Using Windows 7. When I RDP to a PC I'd like to be able to logout of the session without the screen reverting to a Ctrl+Alt+Del Login screen.

The PC's in question are kiosks running Chrome in full screen 'Kiosk Mode'. So it's important they revert back to the normal browser home page.

I have successfully managed to do logout by creating a .bat file in C:\bat called rdp_logout.bat. The contents of this .bat file are below;

tscon.exe 2 /dest:console
EXIT

I then created a shortcut on my desktop to this .bat file (send to > desktop). I changed the permissions of the .bat file to run as administrator. When I want to logout of the 'Kiosk' I do the following;

  • Open the browser in Kiosk Mode
  • WinKey+R
  • Input "cmd"
  • Enter

This opens the command prompt (on top of) the browser with the following displayed;

C:\Users\Administrator

I then type;

cd Desktop

"rdp_logout.bat - Shortcut.lnk"

This does run, and logs me out. However whenever I RDP to the same PC immediately afterwards, the command prompt window is still showing 'on top' of the browser.

What do I need to change in order to hide the command window after the .bat files has ran?

jonboy

Posted 2016-02-09T10:25:14.760

Reputation: 209

Don't open a command prompt, just press windows + R and run this directly: %userprofile%\desktop\rdp_logout.bat – Ricardo Bohner – 2019-11-27T13:27:00.760

Answers

1

Try this.

Timeout 2
taskill /f /cmd.exe

to the end of you .bat

This will Kill the window to kill itself after you log out. The Pause is so it does not kill it before your logout command runs.

NetworkKingPin

Posted 2016-02-09T10:25:14.760

Reputation: 2 186

1

You don't have to create bat file, just:

  • Win+R
  • paste your command: tscon.exe 2 /dest:console

  • hit enter

dedomraz

Posted 2016-02-09T10:25:14.760

Reputation: 11