≡ Menu

Windows : logoff from command line

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

logoff

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.

8 comments… add one
  • Team Viet Dev

    If I want to login from command line, how do I set it up?

  • sakshi

    Open Task manager, click on Users, Right Click, manage user account, it will open control panel. It the path above, open cmd from here. shutdown -l to log out.
    Login again. It works.

  • kenneth Clyne

    need to logoff but cannot

  • asd

    If anyone is reading this, you might want to know none of these command do a force logoff.
    They do the standard logoff, like if you select it from the start menu, i.e. no processes will be killed and you will be prompted to “Sign out anyway” if any are taking their damn sweet time.

    • Srini

      I just checked “shutdown -L” does force logoff.

  • ziv

    i need to log out from anther user with the user name
    sameing like that…
    logoff username:moss /server:172.19.19.50

    can i do it ? same how with one bat file ?

  • justme

    Why isn’t this stuff dated?

  • Raymond

    I am using windows XP professional, at the time of shutdown , after PC gets logged off system runs synchronization process and copy files to another PC. I want to know the details of that process. Please help.

Cancel reply

Leave a Comment