Windows Command Line: logoff

We can logoff a user session by clicking on the Logoff button in the start menu. We can logoff from command prompt(CMD) too using shutdown command. You need to run the below command.

shutdown -L

Shutdown is a Windows in-built command. We don’t have to install it separately. Note that we can run this command from windows Run window also. This command works on all windows editions. (XP, Vista, Server 2k3/2k8, Windows 7)

There’s another command Logoff which also serves the same purpose. This command can be used to logoff sessions on the remote computers also. Find syntax below for this.

logoff /server:remote_computer_name

To logoff on the current system


This does not accept user name and passwords so it uses the credentials of the current logged in user on the host system.

How to force logoff without waiting for user confirmation to terminate the running applications?

The above commands do forced logoffs.  They kill all the applications one by one and at the end logs off the user.