Windows logoff from command line

on November 25, 2010

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.

If you are wondering how to logoff or Shutdown computer using command prompt then the below guide can help you out. This CMD works with Windows 10, 8, 7 and XP. Although there is a very simple and easy option provided by Microsoft to switch the user account or even shutdown, both options are available at the Start button.

How to Logoff using Command Line

The logoff command is used to sign out any unwanted user from your device remotely.

Method 1

To switch the user account, use Logoff command in Run box. This command can be used to log off the system. All you have to follow below steps:

1) Press Ctrl+R key together

2) Type logoff and click on OK

3) This will logoff your system and take you to the login page.

The above command can be used to logoff from the current system.

Method 2

Similarly, you can force a remote computer to logoff from the system using below command:

logoff /server:remote_system_name

Now, let’s have a look at how to shut down the system using Command Prompt. If you want to allow the user to save his work before logging him off remotely, follow the below-given steps:

1) Press the Windows button

2) Type Command Prompt, right-click over it select  Command Prompt (Admin) 

Click on Prompt Admin

3) Select Yes if “User Account Control” dialogue box appears
4) Once the Command prompt window opens, type: shutdown /l or, shutdown -l
5) Type exit to close the command prompt

This will shut down the computer.

Method 3

This method doesn’t include command prompt but you can log off from the system using shortcut keys:

1) Press Ctrl+Shfit+Esc button together

2) Click on User tab

3) Right-click over the currently logged-in user and choose Log Off

Log off system using task manager

This will log-off from the current system and take you to the login page.

How to Shutdown using Command Prompt 

If you want to forcefully logoff the user without giving him the option to save his work, then there are two methods that can be used:

Method A: Using Query command

1) Click on Start, type Command Prompt

2) Right-click over it and choose Command Prompt (Admin) from the pop-up menu

Click on Prompt Admin

3) Select Yes if “User Account Control” dialogue box appears
4) Once the Command prompt window opens, type: query session and hit Enter button

This lists the number of users signed into your device along with their username, ID number, state, type, and device.

5) Choose the user ID affiliated with the person who you want to log off from your device and type: logoff <ID number> without the brackets. This will sign out the affiliated user without giving any alert to him or you.
6)  Check if a user has been logged off by typing: query again. If the logged off user’s name is not in the list of users signed into your device, then the command has been successful.
7) Type exit to close the command prompt

Method B: Using Shutdown command

1) Click on Start button and type Command Prompt

2) Right-click over Command prompt and choose Command Prompt (Admin)

Click on Prompt Admin

3) Select Yes if “User Account Control” dialogue box appears
4) Once the Command prompt window opens, type: shutdown /l /f /t 00 or, shutdown -l -f -t 00 and press Enter
5) Type exit to close the command prompt

Logoff WindowsКоманда LOGOFF используется для завершения сеанса пользователей в Windows при помощи командной строки.

Синтаксис команды LOGOFF:

LOGOFF [имя_сеанса | ID_сеанса] [/SERVER:сервер] [/V] [/VM]

Имя сеанса — имя сеанса пользователя;

ID сеанса — идентификатор сеанса пользователя;

/SERVER — имя или IP-адрес хоста. Если не указан, то сеанс завершается на текущем компьютере;

/V — отображение информации о выполненных действиях;

/VM — завершение сеанса на сервере или в виртуальной машине. Необходимо указать уникальный идентификатор сеанса.

Имя или идентификатор сеанса пользователя можно посмотреть при помощи команды QUSER.

Посмотрим на примеры использования команды LOGOFF.

Завершить текущий сеанс пользователя на локальной машине:

logoff

Завершить сеанс с именем rdp-tcp#1 на компьютере PC-1:

logoff rdp-tcp#1 /server:pc-1

Завершить сеанс с идентификатором 1 на компьютере PC-1 с отображением информации о выполняемых действиях:

logoff 1 /server:pc-1 /v

В качестве альтернативы команде LOGOFF можно использовать команду SHUTDOWN с ключом /l (или -l).

Logging off Windows is a task that many Windows users are familiar with. It’s a simple process that allows you to end your current session and securely log out of the system. But did you know that there is a way to log off Windows using the command line? This article will provide a comprehensive guide to the logoff CMD command, including syntax, options, user examples, and more.

What is the Logoff CMD Command?

The logoff CMD command is a command line prompt that allows you to log off Windows from the command line. It is a useful tool for system administrators who need to quickly log off multiple users from a system. The logoff command can be used to log off the current user, or to log off a specific user.

Syntax of the Logoff CMD Command

The syntax of the logoff CMD command is as follows:

  • logoff [/server server_name] [/v] [/f] [/n] [/d domain_name] [/m computer_name] [/l]

The logoff command has several options that can be used to modify the behavior of the command. These options are described in the table below:

Option Description
/server server_name Specifies the name of the server to log off from.
/v Displays verbose output.
/f Forces the logoff of the user, even if there are open applications.
/n Logs off the user without displaying any confirmation messages.
/d domain_name Specifies the name of the domain to log off from.
/m computer_name Specifies the name of the computer to log off from.
/l Logs off the user without displaying any confirmation messages.

Examples of the Logoff CMD Command

The logoff CMD command can be used in a variety of ways. Here are some examples of how to use the logoff command:

  • To log off the current user, type logoff at the command prompt.
  • To log off a user from a specific server, type logoff /server server_name at the command prompt.
  • To log off a user from a specific domain, type logoff /d domain_name at the command prompt.
  • To log off a user from a specific computer, type logoff /m computer_name at the command prompt.
  • To log off a user without displaying any confirmation messages, type logoff /n at the command prompt.
  • To force the logoff of a user, even if there are open applications, type logoff /f at the command prompt.

Conclusion

The logoff CMD command is a useful tool for system administrators who need to quickly log off multiple users from a system. It can be used to log off the current user, or to log off a specific user from a server, domain, or computer. The logoff command has several options that can be used to modify the behavior of the command. This article has provided a comprehensive guide to the logoff CMD command, including syntax, options, user examples, and more.

Table of Contents

  • Case
  • Solution

Case #

You need to locally or remotely logoff a Windows user but when clicking logoff/sign out from the task manager, the UI does not respond and nothing happens.

Solution #

You need to use the Windows terminal / CLI or Powershell to forcefully logoff a user. To force logoff a Windows user when being logged on locally on that machine, run the below commands on an elevated command prompt or Powershell window. The quser command output provides the user session ID, which you must use in the subsequent command to successfully logoff the stuck user.

quser
logoff [user session ID]

In the above example, there is only one user logged on at the moment, however in cases where there are other users stuck in disconnected state and you cannot log them off otherwise, the above commands can come in very handy. Also you can remotely logoff a user by using Powershell remoting or PsExec.

  • Windows loader для windows vista
  • Windows loader by daz для windows 7 скачать
  • Windows loader для win 10
  • Windows loader by daz для windows 7 32 bit
  • Windows loader x32 by daz