What you can and cannot change in Command Prompt
Command Prompt itself does not let you change your Windows username. What you can do in Command Prompt is switch to a different user account temporarily, run commands as a different user, or view which account you are currently logged in as. If you want to permanently change your Windows username — the name that appears on your login screen and in File Explorer — you need to use Windows Settings, not Command Prompt.
This distinction matters because many people search for "change username in Command Prompt" when they actually want to change their account name in Windows. Command Prompt is a tool for running commands and managing files; it is not the place where user accounts are created or renamed.
If you are looking to switch to a different user account temporarily, or if you need to run a single command under a different account's permissions, Command Prompt can help. If you want to rename your actual Windows account, scroll down to the Windows Settings section.
Key Takeaways
- Command Prompt cannot rename your Windows user account; you must use Windows Settings or Control Panel to do that.
- You can view your current username by typing whoami and pressing Enter in Command Prompt.
- You can switch to a different user account temporarily using the runas command, which runs a single program under a different account's permissions.
- Renaming your Windows account in Settings takes about two minutes and does not require administrator access if you own the account.
How to see your current username in Command Prompt
Open Command Prompt by pressing Windows key + R, typing cmd, and pressing Enter. At the prompt, type whoami and press Enter. Command Prompt will display your username in the format COMPUTERNAME\username. The part after the backslash is your actual username.
If you want to see more detail about your account, type net user %username% and press Enter. This shows your account name, whether it is an administrator account, when you last logged in, and other account properties. Neither of these commands changes anything — they only display information.
How to run a command as a different user
If you need to run a single program or command under a different user account, use the runas command. The basic format is runas /user:COMPUTERNAME\username program.exe. For example, to open Notepad as a different user, you would type runas /user:COMPUTERNAME\otheruser notepad.exe and press Enter. Command Prompt will prompt you for that user's password.
This is useful if you need to test whether a file or program works under a different account, or if you need to run something that requires different permissions. It does not change your username or your login account — it only runs that one program under the other account. When you close the program, you are back to your original account.
If the other user account is on a different computer on your network, include the computer name: runas /user:OTHERMACHINE\username program.exe. If you do not know the computer name, type hostname in Command Prompt to see your own computer's name.
How to rename your Windows account in Settings
To permanently change your username, open Windows Settings by pressing Windows key + I. Click Accounts on the left side, then click Your info at the top. You will see your current account name displayed. Click the Rename your account button, type your new username, and click Next. Windows will ask you to confirm; click Finish and restart your computer.
Your new username will appear on the login screen and in File Explorer the next time you log in. This change affects your entire Windows account, not just Command Prompt. If you have files in your user folder (usually C:\Users\oldusername), Windows will keep them in a folder with your old name, but you will still be able to access them normally.
If you do not see a Rename your account button, you may be using a Microsoft account instead of a local account. For Microsoft accounts, you must change your name through your Microsoft account settings online, not in Windows Settings. Go to account.microsoft.com, sign in, and look for account profile settings.
How to rename your account in Control Panel (older Windows versions)
If you are using an older version of Windows or prefer Control Panel, you can rename your account there as well. Press Windows key + R, type control userpasswords2, and press Enter. Select your account name in the list and click Properties. In the General tab, you will see a text field with your current username. Click in that field, clear it, type your new username, and click explore and OK.
This method works on Windows 7, Windows 8, and Windows 10. On Windows 11, the Settings method above is faster and more straightforward. Either way, you will need to restart your computer for the change to take effect.
Why you might want to change your username
People change their Windows username for several reasons: they want a shorter or more professional name, they inherited a computer with someone else's account, or they set up their account with a temporary name and want to change it now. Whatever the reason, the process is straightforward and does not affect your files, programs, or settings.
One thing to keep in mind: if you have batch files, scripts, or programs that reference your old username in file paths, those references will break after you rename your account. For example, if a shortcut points to C:\Users\oldname\Documents\file.txt, it will no longer work after you rename your account to newname. You will need to update those paths manually or recreate the shortcuts.
Frequently Asked Questions
Does changing my username in Command Prompt affect my login password?
Command Prompt cannot change your username at all. If you change your username through Windows Settings or Control Panel, your password stays the same — you will still log in with the same password you used before.
Can I have two usernames on the same computer?
Yes. Windows allows multiple user accounts on one computer. Each account has its own username, password, files, and settings. You can switch between accounts at the login screen or use the runas command to run a program under a different account without logging out.
What happens to my files if I rename my account?
Your files stay in your user folder, which keeps its original name. If your old username was "john" and you rename it to "jane", your files remain in C:\Users\john, but you can still access them normally through File Explorer. You do not need to move or copy anything.
Can I change my username if I forgot my password?
No. You must log in to your account to change its username. If you have forgotten your password, you will need to reset it first through the Windows login screen or through your Microsoft account online, depending on what type of account you have.
Is there a Command Prompt command that renames my Windows account?
There is no single Command Prompt command that renames your user account. The net user command can change some account properties, but renaming the account itself must be done through Windows Settings or Control Panel. Command Prompt is designed for running programs and managing files, not for renaming user accounts.