Команда logoff windows 10

Windows 10 and other operating systems store all data on a PC based on the logged in user account. It is very common, in family and in public areas, for multiple users to use a single PC. Even one person can have multiple user accounts on a same PC for carrying out different tasks. Windows 10 will prompt you to enter username and password when you login to your computer for booting. After that instance, you can simply log out from one account and switch to another account without shutting down your computer.

Log Off / Sign Out and Switch Account

Before we explain further, there are few confusions when using the word “log off”.

  • Microsoft uses this function as “log off” in earlier versions like Windows 7. In Windows 10, you can see Microsoft renamed the same feature as “Sign Out” instead of “Log Off”. So, do not get confused, sign out and log off are the same with different names.
  • Windows 7 has logoff under power button. However, in Windows 10, the power button will have restart, shut down and sleep options. The sign out option is moved to different places in the menu items. Generally, this makes sense that the logging out is not an option connected at your computer level like shut down or restart. Since it applies at user level, it is supposed to be in the user account section. Moving the place of the frequently used menu item is the only confusion especially when you are habituated with Windows 7.
  • Another confusion is with “switch account” option. Switch account is a super easy function that helps to switch between use accounts without terminating any of the logged in users.

When you log off or sign out, Windows will close all open applications and terminate your account from the connected network. You can switch to another user account or login to the same account again from the lock screen. When you login, you will see the desktop similar to normal startup without any open applications running. All programs need to initialize from the beginning like reconnecting to mapped network drives.

On other hand, switching account will retain all open applications of the previous user when switching to another account. This means you can simply toggle accounts at any point of time and continue where you left after login in both user accounts. All previously open applications will continue to run when switching the account though your network may disconnect and reconnect again.

Understanding this difference in mind, let us explain different ways to sign out of your Windows 10 computer. We use sing out in remaining part of this article with the similar meaning as log off as Windows 10 uses in the same manner. In addition, the possibilities of switching account is mentioned wherever it is applicable.

7 Ways to Log Off or Sign Out from Windows 10 User Account

  1. From Start menu user account
  2. Using power menu
  3. Sign out from Command Prompt
  4. Use Ctrl + Alt + Del
  5. Shut down options from Alt + F4
  6. From Run Command
  7. Adding shortcut to desktop

1. Start Menu

Windows 10 has no sign out or switch account option in the power button on start menu. Microsoft simply removed this option and moved under the user account button. Click on the “Start” button and then click on the logged in user profile picture. You can choose to sign out or switch account from here.

When multiple users are logged in, then you can directly choose different user account to switch the account without signing out from the account.

2. Power Menu

Press “Win + X” shortcut keys or simply right click on the start button to open power menu. Click on “Shut down or sign out” option and choose “Sign out”. As you can see in power menu, you will only have option for signing out and no option for switching account is available.

Sign Out in Power Menu

Sign Out in Power Menu

3. Sign Out from Command Prompt

After pressing “Win + X” keys, choose “Windows PowerShell” option from the menu. Note, if you are not seeing PowerShell then you will see Command Prompt option. You can choose either Command Prompt or Windows PowerShell whatsoever showing in the menu. Enter the command “shutdown /l” and hit enter.

Sign Out from Command Prompt

Sign Out from Command Prompt

Windows will sign out instantly and go back to the lock screen.

4. Ctrl + Alt + Del

This is the most popular shortcut to shut down your computer. Here you will have options to sign out or switch account between users.

5. Alt + F4

This is another popular shortcut to close applications in Windows. First, close all open applications and press “Alt + F4”. You will see “Shut Down Windows” popup opens. Click on the dropdown and choose “Sign Out” option.

Sign Out from Alt F4 Options

Sign Out from Alt F4 Options

6. Run Logoff Command

Press “Win + R” to open “Run” dialog box. Type “logoff” and enter to sign out of your account. Windows 10 will signing out of your account instantly.

7. Adding Sign Out or Log Off Shortcut Menu

If you do not like any of the above mentioned method for signing out of your computer then there is a trick you can do to make the process simpler. Type “logoff” in the Windows or Cortana Search Box. You will see the first options as “Logoff” as Run Command which is the option explained in previous step. Right click on that and choose “Open file location”.

Open File Location of Logoff Executable File

Open File Location of Logoff Executable File

This will open the path “C:\Windows\System32” where “logoff.exe” file is stored on your computer. Right click on the “logoff” file and choose “Send to > Desktop (create shortcut)”.

Create Desktop Shortcut for Logoff Option

Create Desktop Shortcut for Logoff Option

This will add the shortcut in your desktop for logoff option. Simply double click on the desktop shortcut to quickly sign out of your computer.

Logoff Shortcut on Desktop

Logoff Shortcut on Desktop

Lock with Win + L

Press “Win + L” to lock your computer. Here you will not find any sign out option. However, if your objective is to switch the account to another user then click on “Other user” and login as different user account.

Conclusion

Hope you understand many ways to signing out of your computer without hassle. Note, when you sign out or run logoff command, Windows 10 will immediately start signing out without any notice. Though sometimes you will see a warning message showing there are open applications, it will not help you in saving the working documents. So in order to avoid loss of work, remember to save and close all your working documents and folders before signing out / logoff in any of the methods.

In the start menu, click the Logoff button to log off a user session. You can shut down using the shutdown command from the CMD. The following command needs to be run.

shutdown -L

Windows has an inbuilt shutdown command. Installing it separately is not necessary. The Run window in Windows also allows us to run this command. All versions of Windows support this command.

It is also possible to logoff using the Logoff command. Remote computers can also be logged off using this command. This can be found in the following syntax.

logoff /server:remote_computer_name

In order to log off a system

logoff

Passwords and user names are not accepted. As a result, the authentication process on the host system uses the credentials of the currently logged-in user.

What is the best way to force the running programs to terminate without waiting for user confirmation?

Logging off with the commands above does force a logout. One by one, they killed each application and then logged off the user.

You may also like: Run Command for Startup Programs

Skip to content

How to Log Off Another User in Windows 10

Although the concept of multiple users sharing one device or one PC is getting rarer by the day, there are still cases when you have to share PCs and switch users fast. Sometimes you need to end a session for another user signed in to your computer. Here are a number of methods you can use.

The situation can be different when you need to end a user session. For example, someone just forgot to sign out from his or her user account, and left running apps and opened docs, so the remain in your computer’s memory and consume its system resources. In this case, it could be useful to kick out the inactive session for the other user.

There are no third party tools required. This can be done using either Task Manager, Command Prompt or PowerShell.

  1. Open the Task Manager app.
  2. If it looks as follows, switch it to the full view using the «More details» link in the bottom right corner.
  3. Click on the Users tab.
  4. Right-click on a user account you want to log off.
  5. Select Sign off from the context menu.
    Windows 10 Logoff Another User

You are done.

Alternatively, there are a couple of console tools we can use for the same purpose. Let’s review them.

Log Off Another User from the Command Prompt

  1. Open an elevated command prompt.
  2. Type or copy-paste the following command:query session. This will list available user sessions.
  3. Note the ID column value for the user you want to sign off.
    Windows 10 Logoff Another User With Cmd

  4. Now, execute the command logoff <ID>. For example, logoff 1.

You are done.

Finally, you can use PowerShell, as follows.

Log Off Another User from with PowerShell

  1. Open PowerShell as Administrator.Tip: You can add «Open PowerShell As Administrator» context menu.
  2. Type or copy-paste the following command:$sessionID = ((quser /server:'you computer name' | Where-Object { $_ -match 'user name to sign off' }) -split ' +')[2]
  3. Now, execute the command logoff $sessionID.
    Windows 10 Logoff Another User PowerShell

The PowerShell method is great when you know the exact user name. You can save it as a script and sign out other users with one click when needed.

That’s it.

Related blog posts:

  • Find the Sign Out Log in Windows 10
  • All ways to sign out from Windows 10

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won’t take a lot from you, but it will help us grow. Thanks for your support!

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.

Несколько раз встречался с ситуацией, когда один из пользователей Windows Server с ролью RDS (Remote Desktop Services) запустил приложение, которое утекло и заняло всю доступную RAM. Удаленно подключиться к такому хосту по RDP невозможно. Чтобы завершить утекший процесс, нужно выполнить удаленный логофф пользователя. Для этого можно использовать встроенную команду logoff.

Синтаксис команды logoff.exe:

logoff /server:<servername> <session ID> /v

Команда logoff принимает ID сессии пользователя, которую нужно завершить. Чтобы вывести список активных сеансов пользователей на удаленном компьютере, выполните команду:

quser /server:RemoteComputerName

USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
admin console 1 Active none 1/25/2023 1:23 PM

quser - список активных сессий на удаленном компьютере Windows или RDS

В данном случае на компьютере выполнен локальный вход (console) под пользователем admin. ID этой сессии равно 1.

Можно получить ID сессии определенного пользователя:

quser /server:RemoteComputerName sidorov

Совет. Если пользователь подключен через Remote Desktop, в поле SESSIONNAME будет указано rdp-tcp#X.

Вы можете удаленно завершить сеанс пользователя по его ID сессии. Выполните команду:

logoff 1 /SERVER:RemoteComputerName /v

Logging off session ID 1

При завершении сеанса пользователя, будут завершены все его запущенные процессы.

Проверьте, что на удаленном компьютере не осталось активных сессий:

quser /server:RemoteComputerName

No User exists for *

Можно использовать небольшой скрипт, чтобы завершить все сеансы пользователей на нескольких терминальных серверах:

@echo off
setlocal
set servers=MSKRDS1 MSKRDS2
for %%s in (%servers%) do (
qwinsta /server:%%s | for /f "tokens=3" %%i in ('findstr /I "%username%"') do logoff /server:%%s %%i /v
)

Также для удаленного завершения сессий пользователей можно использовать встроенную утилиту rwinsta:

rwinsta rdp-tcp#12 /server:MSKRDS2

или

rwinsta 22 /server:MSKRDS2

rwinsta - сбросить удаленную сессию пользователя

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Hotline miami 2 не запускается на windows 10
  • Звуковой пакет для windows
  • Не могу никак активировать windows 7
  • Авто активация windows 10 pro
  • Поддержка андроид приложений на windows 11