Have you ever forgotten your Windows password and wondered how to reset it without needing to go through the hassle of contacting support or reinstalling your operating system? If so, then this article is for you. In this article, we will guide you through the step-by-step process of resetting your Windows password using the Command Prompt (CMD). This method is simple, effective, and can be done in just a few minutes.
Before we begin, it’s important to note that this method only works for local user accounts. If you are using a Microsoft account to log in to Windows, you will need to use a different method to reset your password. Additionally, you will need to have access to the Administrator account on your computer in order to perform these steps. If you do not have access to the Administrator account, you may need to contact your system administrator for assistance.
Now that you have gathered the necessary information, let’s get started with the steps on how to reset password with Cmd. First, you will need to open the Command Prompt. To do this, press the Windows key + R and type “cmd” into the Run dialog box. Then, click OK. Once the Command Prompt is open, you will need to type the following command and press Enter: net user username new_password. Replace “username” with your username and “new_password” with your new password. For example, if your username is “John” and your new password is “password123”, you would type the following command: net user John password123. Once you have entered the command, press Enter and your password will be reset. You can now close the Command Prompt and log in to Windows using your new password.
Launch Command Prompt
Command Prompt is a command-line interface that allows you to execute commands in Windows operating systems. To launch Command Prompt, follow these steps:
1. Open the Start menu
Click the Windows icon in the bottom-left corner of your screen or press the Windows key on your keyboard. In the search bar, type “command prompt”.
2. Right-click Command Prompt
When Command Prompt appears in the search results, right-click it and select “Run as administrator”. This will launch Command Prompt with elevated privileges, which is necessary for resetting your password.
3. Enter the net user command
In the Command Prompt window, type the following command and press Enter:
net user [username] [new password]
Replace “[username]” with your Windows username, and replace “[new password]” with your desired new password. For example, if your username is “John” and you want to set your password to “123456”, you would type the following command:
net user John 123456
If you want to reset the password for another user on your computer, you will need to specify their username instead of your own.
4. Verify the password change
After entering the command, you should see a message indicating that the password has been successfully reset. To verify the change, log out of your Windows account and log back in using your new password.
Navigate to User Profile Directory
To navigate to the user profile directory, follow these steps:
- Open the Start menu and type “cmd”.
- Right-click on “Command Prompt” and select “Run as administrator”.
- In the Command Prompt window, type the following command and press Enter:
cd %userprofile%
This will take you to the user profile directory. You can now reset the password for the current user.
Once you are in the user profile directory, you can reset the password for the current user using the following steps:
- Type the following command and press Enter:
net user username newpassword
Where “username” is the name of the user account you want to reset the password for and “newpassword” is the new password you want to set.
- Confirm the new password by typing it again and pressing Enter.
- Insert the bootable USB drive or DVD into your computer and restart it.
- On the Windows Setup screen, choose your language and other preferences, then click “Repair your computer”.
- On the “Choose an option” screen, click “Troubleshoot”.
- On the “System Recovery Options” screen, click “Command Prompt”.
-
Click the Start button in the bottom left corner of your screen.
-
Select the Power icon.
-
Click the Restart option.
-
Wait for your computer to restart.
-
Once your computer has restarted, try logging in with your new password.
- Press Windows Key + R to open the Run dialog box.
- Type "net user administrator /active:no" in the Run dialog box and press Enter.
- The built-in Administrator account will now be disabled.
- You must have an alternative user account with administrative privileges to disable the built-in Administrator account.
- If you disable the built-in Administrator account and lose access to your primary user account, you may need to use a Windows recovery disk to reset the password for your primary user account or re-enable the built-in Administrator account.
- Disabling the built-in Administrator account is a security measure and should not affect the normal functioning of your computer.
- Restart your computer and press F8 before the Windows logo appears.
- Select "Safe Mode with Command Prompt" from the boot options.
- At the Command Prompt, type the following command and press Enter:
net user [username] [new password]
- Replace "[username]" with your actual username and "[new password]" with the new password you want to set.
- Press Enter again to execute the command.
- Restart your computer normally and log in with the new password.
- Click on the Start menu.
- Type "cmd" in the search bar.
- Right-click on "Command Prompt" and select "Run as administrator".
The password for the user account has now been reset. You can now log in to the user account using the new password.
Rename SAM File
Now that you have booted into the Windows Recovery Environment, you need to rename the SAM file. This file is located in the Windows\System32\config directory. To rename the file, you can use the following command:
ren %windir%\system32\config\SAM SAM.bak
This command will rename the SAM file to SAM.bak. You can now close the Command Prompt window and restart your computer. Windows will now boot into Safe Mode and you will be able to reset your password.
Caution
Renaming the SAM file is a risky operation. If you make a mistake, you could corrupt your Windows installation. It is recommended that you only perform this operation if you are confident in your abilities.
Important
The SAM file is a sensitive file. It is recommended that you back up the file before you rename it. You can do this by copying the file to a USB drive or another location.
Command Description ren %windir%\system32\config\SAM SAM.bak Renames the SAM file to SAM.bak Boot into Windows Recovery Environment
Step 1: Insert your Windows installation media (USB/DVD).
Step 2: Restart your computer.
Step 3: Press the appropriate key (e.g., F12) to enter the boot menu.
Step 4: Select the USB/DVD drive as your boot device.Step 5: On the “Install Windows” screen, click “Repair your computer.”
Step 6: In the “Choose an option” screen, select “Troubleshoot.”
Step 7: Click “Advanced Options.”
Step 8: Select “Command Prompt.”
How to Reset Password Using Cmd
Step 1: Once the Command Prompt window opens, type the following command and press Enter:
net user [username] [new_password]
For example, net user administrator NewPassword123Step 2: You should receive a message confirming that the password has been changed successfully.
Step 3: Type exit and press Enter to close the Command Prompt.
Step 4: Click “Continue” to restart your computer.
Note: If you do not know the administrator username, you can use the following command to find it:
net user
This will output a list of all user accounts on the system.Reset Password Using Safe Mode
Step 1: Restart your computer.
Step 2: Press and hold the Shift key while clicking the Restart button.
Step 3: In the “Choose an option” screen, select “Troubleshoot.”
Step 4: Click “Advanced Options.”
Step 5: Click “Startup Settings.”
Step 6: Click “Restart.”
Step 7: After your computer restarts, you will see a list of startup options.
Step 8: Choose “Safe Mode with Command Prompt.”
Step 9: Follow the steps in the previous section to reset your password using the Command Prompt.
Open Command Prompt from Recovery Environment
To reset your password using the command prompt from the recovery environment, you’ll need to have a bootable USB drive or DVD containing the Windows installation media. Here are the steps:
Command Description reg load HKLM\SAM c:\windows\system32\config\SAM Loads the registry hive for the Security Account Manager (SAM) database. cd \Windows\System32\config Navigates to the directory where the SAM database is located. ren SAM SAM.bak Renames the existing SAM database to SAM.bak. copy c:\windows\repair\SAM c:\windows\system32\config\SAM Copies the default SAM database from the repair folder to the Config folder. reg unload HKLM\SAM Unloads the SAM registry hive. exit Exits the Command Prompt and restarts the computer. Once your computer restarts, you should be able to log in with the default administrator account. You can then create a new password for your original user account.
Reset Administrator Password
To reset the administrator password using the command prompt, follow these steps:
1. Boot into Recovery Mode
Start your computer and press the appropriate key to enter the BIOS settings (usually F2, F10, or Delete).
2. Change Boot Order
Change the boot order so that your computer boots from the Windows installation media.
3. Boot from Installation Media
Insert the Windows installation media and restart your computer. Follow the on-screen instructions to boot from the media.
4. Select Language and Options
Select the desired language, time and currency format, and keyboard input method.
5. Click “Repair Your Computer”
On the Windows Setup screen, click on the “Repair your computer” option in the bottom-left corner.
6. Access Command Prompt
In the Choose an option screen, select “Troubleshoot” > “Advanced options” > “Command Prompt”.
Restart into Normal Mode
Once you’ve completed resetting your password with Command Prompt, you’ll need to restart your computer into normal mode to test if the changes were successful.
Step 7: Restart Your Computer
Here’s a step-by-step guide on how to restart your computer into normal mode:
If you are able to log in with your new password, then the reset was successful. If you are still unable to log in, then you may need to try a different reset method.
Tip: Before restarting your computer, it’s a good idea to save any open work or files that you may have.
Enable Built-in Administrator Account
Before you can reset your password using Cmd, you need to enable the built-in administrator account. Here’s how to do it:
1. Boot into Safe Mode
Restart your computer and press the F8 key repeatedly until you see the Windows Advanced Options Menu. Select Safe Mode and press Enter.
2. Open Command Prompt
Once you’re in Safe Mode, press Windows Key + R to open the Run dialog box. Type cmd and press Enter.
3. Enable Administrator Account
In the Command Prompt window, type the following command and press Enter:
net user administrator /active:yes
4. Set a New Password for the Administrator Account
Once the administrator account is enabled, you can set a new password for it. Type the following command and press Enter:
net user administrator [new_password]
5. Log in as Administrator
Restart your computer and log in using the administrator account and the new password you set.
6. Open Command Prompt as Administrator
Once you’re logged in as administrator, press Windows Key + R to open the Run dialog box. Type cmd and press Ctrl + Shift + Enter to open Command Prompt as administrator.
7. Change User’s Password
In the Command Prompt window, type the following command and press Enter to change the password for any user account:
net user [username] [new_password]
8. Reset Local Account Password Using Net User Command
To reset the password of a local account using the Net User command, follow these steps:
a) Open Command Prompt as Administrator: As explained in step 6, open Command Prompt with elevated privileges.
b) Run the Net User Command: In the Command Prompt window, type the following command and press Enter:
net user
Replace
with the username of the local account you want to reset the password for, and with the new password you want to set. c) Example: To reset the password of a local account named "John" to "P@ssw0rd!", type the following command and press Enter:
net user John P@ssw0rd!
d) Verify Password Reset: After executing the command, you can verify that the password has been reset by logging into the local account using the new password.
Disable Built-in Administrator Account
The built-in Administrator account is a highly privileged account that can make changes to the system that could compromise its security. For this reason, it is generally recommended to disable the built-in Administrator account and create a new user account with limited privileges for everyday use.
Steps to Disable Built-in Administrator Account
To disable the built-in Administrator account, follow these steps:
Additional Considerations
When disabling the built-in Administrator account, keep the following in mind:
Command Description net user administrator /active:yes Enables the built-in Administrator account net user administrator /active:no Disables the built-in Administrator account Delete Temporary Files
To delete temporary files using Cmd, follow these steps:
1. Open Command Prompt
Press Windows key + R to open the Run dialog box, type "cmd" and press Enter.
2. Navigate to the Temporary Folder
Type the following command and press Enter:
cd %temp%
3. Delete Temporary Files
Type the following command and press Enter to delete all temporary files and folders:
del * /s /q
Alternatively, you can use the following command to delete temporary files that are older than 24 hours:
forfiles /p %temp% /s /m * /d -1 /c "cmd /c del @file"
4. Confirm Deletion
A confirmation message will appear. Type "Y" and press Enter to confirm the deletion.
5. Repeat for Other Users
If you have multiple user accounts on your computer, you may need to repeat this process for each account.
6. Empty Recycle Bin
After deleting the temporary files, empty the Recycle Bin to permanently remove them from your computer.
7. Restart Computer
Restart your computer to complete the process.
8. Check Disk Space
After restarting, check your available disk space to see if the temporary files have been successfully deleted.
9. Schedule Automatic Cleanup
To automatically delete temporary files on a regular basis, create a scheduled task in Task Scheduler.
10. Advanced Methods Using PowerShell
For more advanced options, you can use PowerShell commands to delete temporary files. Here are some examples:
Command Description Get-ChildItem -Path $env:TEMP -Recurse | Remove-Item -Force Deletes all files and folders in the temporary folder Remove-Item $env:TEMP\* -Recurse -Force Same as above Get-ChildItem -Path $env:TEMP -Filter *.tmp -Recurse | Remove-Item -Force Deletes only files with the ".tmp" extension How to Reset Password with CMD
In case you forget your Windows password, you can easily reset it using the Command Prompt (CMD). Here's a step-by-step guide:
People Also Ask
How do I open CMD as administrator?
To open CMD as an administrator, follow these steps:
How do I reset a forgotten password without CMD?
If you don't have access to CMD, you can reset your password by using the Microsoft account password reset tool. Visit the Microsoft account password reset page and follow the instructions.
- Type the following command and press Enter: