Lock Computer,Workstation, Desktop or Server from Command Line – Command Prompt

Lock Computer from Command Line

Lock Windows From Command line

Lock a Desktop or Server from Command line

Lock A Desktop using Command line

To lock a computer desktop or server from a command line or command prompt use the following (not case sensitive):

RUNDLL32 USER32.DLL,LockWorkStation

To run the command, open a command prompt window by clicking on Start then type cmd (or upper case CMD – case does not matter) then hit enter or click on the small CMD icon that appears as you search above the search field itself.


When the command window opens paste or type RUNDLL32 USER32.DLL,LockWorkStation  and hit enter.

CTRL ALT DELETE while in Remote Desktop RDP /RDC session

To send Control Alt Delete while in an RDP / RDC remote control session use the keys CTRL + ALT plus the End key.

Logoff using Command line

To logoff a workstation (XP, Windows 7 , Windows 8) or Microsoft Server and version open a command window and type logoff and hit enter (case does not matter so you may use LOGOFF )