Want to switch users in Windows without opening the Start menu? The command line offers a quick way to log in as another account—useful for testing permissions, managing remote sessions, or troubleshooting. The method uses built-in Windows tools like `net user` or `runas`, but you’ll need admin rights, and some accounts may block remote logins. Below is a complete guide to switching users via the command line, including safety checks, common pitfalls, and how to fix them.

What You'll Need

  • Windows 10 or 11 (both support this method).
  • A user account with administrator privileges (to switch to any account, including standard ones).
  • The target user’s username and password (or a password prompt will appear).
  • Command Prompt (run as admin for full access).
  • If switching to a local account without a password, ensure Run as Administrator allows it (check via net user later).

Step-by-Step

  1. Open Command Prompt as Administrator: Press Win + X and select Terminal (Admin) (or Command Prompt (Admin) in Windows 10). In Windows 11, right-click the Start button and choose Terminal (Admin). If prompted by UAC, click Yes.
  2. Switch to another user with a password: Use the `runas` command. Replace USERNAME and PASSWORD with the target account details: runas /user:USERNAME PASSWORD

    Example:

    runas /user:AdminUser Password123

    You’ll be prompted to confirm the switch with a UAC prompt (click Yes). The session may hang briefly as the desktop loads.

  3. Switch to a local account without a password: If the account has no password, try: runas /user:USERNAME

    If this fails, check if the account is disabled or locked out. Run: net user USERNAME in Command Prompt to verify the account’s state. If locked, try: net user USERNAME /active:yes (admin-only).

  4. Switch to a remote session (if needed): For remote logins (e.g., RDP), use: runas /netonly /user:DOMAIN\USERNAME PASSWORD

    Replace DOMAIN\USERNAME if the account is on a remote server. Ensure Allow users to connect remotely is enabled in Control Panel > System > Remote Settings (admin-only).

  5. Verify the switch: After running the command, you’ll see: WARNING: This will log you off the current session and switch you to the specified user. Continue? (Yes/No) [No]: Yes Click Yes to proceed. The new session will display the desktop with the target user’s files and settings.

If That Did Not Work

If the command fails, check these steps in order: 1. **UAC Block**: The target account may block remote sessions. Run: net user USERNAME /active:yes (admin-only) to enable it. 2. **Admin Rights**: Ensure you’re running Command Prompt as Administrator. Close and reopen it. 3. **Account Lockout**: Use net user USERNAME /active:yes (if locked) or check with net user USERNAME. 4. **Typo in Username/Password**: Double-check the account name and password. 5. **Windows Update Issues**: Run: DISM /Online /Cleanup-Image /RestoreHealth and reboot. Update Windows via Settings > Windows Update > Check for Updates. 6. **Target Account Restrictions**: Some accounts (e.g., child profiles) may require explicit permission via parental controls. Check Settings > Accounts > Family & Other Users > Add or Remove Accounts > Manage Another Account.

Common Mistakes

  • Running Command Prompt without admin rights: The switch fails silently or shows "Access Denied." Always run Command Prompt as Administrator.
  • Using the wrong username/password: Runas returns an error like Access Denied. Verify the account exists with net user and the password is correct.
  • Locking the account: If runas /user:USERNAME fails, the account may be locked. Use net user USERNAME /active:yes (admin-only) to unlock it.
  • Skipping UAC confirmation: The command may not work unless you click Yes during the UAC prompt.
  • Switching to a disabled account: If the account is disabled, it will show The user name is incorrect. Enable it with net user USERNAME /active:yes.

Tips

  • Test with a simple command: Try switching to an account with a password first. Avoid complex passwords or special characters to avoid issues.
  • Use an admin account for testing: Switching from an admin account to a standard account works reliably. Avoid switching to an admin account unless necessary.
  • Save the command for later: Store the runas command in a script or note for quick reuse. Example: runas /user:AdminUser $(read -sp 'Password: ' PASSWORD); sleep 2; exit (Note: This requires PowerShell, not Command Prompt.)
  • Check remote login permissions: If switching to a remote account, ensure Allow users to connect remotely is enabled (Settings > System > Remote Desktop).
  • Use `wmic` for session tracking: To see active sessions, run: wmic useraccount list in Command Prompt. This helps identify locked or disabled accounts.

Troubleshooting

  1. Command hangs without logging off: The session may be stuck. Restart the computer or reset the session with: net session /purge (admin-only).
  2. Target account shows "The user name is incorrect": The password is wrong or the account is locked. Check with: net user USERNAME and use the correct credentials.
  3. Switch fails with "Access Denied": The target account lacks permissions. Switch from an admin account or use an admin account to switch to another admin account.
  4. No desktop appears after switching: The account may not have a profile. Create one: net user USERNAME /add (if missing) or check if the profile is stored elsewhere (e.g., USB drive).
  5. Runas returns "Runas.exe not found": Your version of Windows may lack runas. Use run instead: run /user:USERNAME PASSWORD (Note: Some older Windows versions use run instead of runas.)

Frequently Asked Questions

Can I switch users in Windows via Command Prompt without admin rights?

No. The `runas` command requires administrator privileges to switch to any account, including standard users. If you lack admin rights, contact your system administrator.

How do I switch to a child profile without admin rights?

Child profiles (e.g., for kids) may have restrictions. Try switching from an admin account first. If that fails, the profile may need to be configured via Settings > Accounts > Family & Other Users > Manage Another Account > Allow Another Account to Connect Remotely (requires enabling remote logging in Windows).

Will switching users via Command Prompt affect my files?

No. Switching users only changes the active session. Your files remain on your hard drive under your username. However, if you log out and switch back, your files may appear in the target account’s folder (e.g., C:\Users\USERNAME).

How do I switch back to my original account after testing?

Use the same method but reverse the command: net user OLD_USERNAME /delete (if switching to a non-existent account) or log out via the desktop session. For a clean exit, close all running processes and reboot.

Can I switch to a remote Windows account from my local PC?

Yes, but only if: 1. Remote Desktop is enabled on the target PC (Settings > System > Remote Desktop > Enable Remote Desktop). 2. The target account has a password and is not locked. 3. Your local PC can connect to the remote PC’s network (e.g., same domain or VPN).

What happens if the target account has no password?

The command runas /user:USERNAME may work, but some versions of Windows block this. Try: run /user:USERNAME or use net user USERNAME /active:yes (admin-only) to unlock it if locked.

Is there a way to switch users silently (without a password prompt)?

No. Windows requires user interaction (UAC prompt or password) for security. Workarounds (e.g., storing passwords in plaintext) violate security policies. Use a password manager or scripted automation with admin privileges for bulk switches.