Search code examples
sessionbatch-fileterminal-server

Batch file to ask for session ID in tsdiscon?


Pardon my very broad question here guys. I don't ever really do much coding (at all) and was hoping you guys could help me out. Basically what I would like to do is have an end user run a script that asks them what Session ID they would like to disconnect. This will be used in conjunction with the "tsdiscon" command.

So the script would open > Ask for session ID > disconnect that session ID.

Seems pretty simple but like I said, I never do any of this. Thank you guys for any help!


Solution

  • It's not very robust, but try this:

    sidkill.bat

    @echo off
    cls
    set /p sid=Enter Session ID:
    echo Disconnecting session %sid%
    tsdiscon %sid%