It's not very often that I post a tip for advanced troubleshooting in Windows, but I ran across this issues recently that I was able to resolve. Had I not been able to resolve it, it would have cost me a LOT of time and very likely data loss. I try to avoid both of those, when possible. In the spirit of sharing knowledge, I wanted to post this for you to have in your back pocket, in the unlikely event that you run into the same situation I did.
A little background info: the other day, I was asked to help restore functionality to a Windows 7 Pro computer where the user had changed their username from "Johnny" to "appleseed" (I am protecting the names of the innocent). On the surface, doing this is easy through the Control Panel > Users > Advanced User Tools. In this case, it caused a problem where the user couldn't log into their account anymore (old or new). To make matters worse, their account was the only account on the computer, so there was no way to log into another Admin account to reset their password. Not good.
The easiest way to reset a forgotten Windows password is to use a previously-created password-reset disk. You can create such a disk (using a USB thumb drive) within the Windows User Accounts menu by opening Control Panel, selecting User Accounts, and clicking Create a password reset disk in the left pane (note: it's a good idea to go through this exercise on a new PC anyway). Once you have the disk, you can insert it when starting the PC to cause Windows to display the "Reset password" option at the login screen, allowing you to regain access to your system.
However, if you don’t have a password-reset disk and you need to reset your Windows password, I recommend using the following Sticky Keys trick. Sticky Keys is an accessibility feature that allows a user to tap the Shift, Ctrl, Alt, or Windows key once to achieve the same effect as holding the key down. Ordinarily, tapping Shift five times activates Sticky Keys -- but with this trick, you are going to make tapping Shift five times activate the Windows Command Prompt instead.
Enter Command Prompt using your Windows Boot Disc
- Boot your computer using your Windows installation disc.
- Wait for the setup files to load, and select your language. Click Next.
- Click the "Repair your computer" option in the lower left-hand corner.
- Select the Operating System to repair, and note the drive letter on which the OS is installed (it is usually C: or D:). Click Next.
- Click "Command Prompt" at the bottom of the list of recovery tools.
Overwrite the Sticky Keys executable with the Command Prompt executable
The instructions below use drive letter C: as an example. If your operating system is installed on another drive, replace C: with the appropriate drive letter.
- In the Command Prompt window, type the following command and press enter:
copy c:\windows\system32\sethc.exe c:\
- Next, type the following command and press enter:
copy /y c:\windows\system32\cmd.exe c:\windows\system32\sethc.exe
Change your Password
Once that is done, you can exit the Command Prompt and restart the computer normally. At the login screen, tap Shift five times. The Command Prompt will open, ready for a command.
Next, we need to reset your Windows account password. To do this, type the following command and press enter (you will want to replace "username" with your username and "password" with your desired password):
net user username password
If you're not sure what your account name is, type the following command and press enter:
This will list all local user accounts on that computer.
Log In Normally
Once you have successfully changed your account password, you can exit Command Prompt and restart your computer normally. At the login screen, you may now log in normally, and your profile will be restored.
Reverse the Changes Made with Sticky Keys
When you have successfully logged in to your account, you can reverse the changes made above so that Sticky Keys work the way they were originally designed. To do this, you will need to boot to the Windows installation disc again, following the same steps as outlined above. When the Command Prompt opens, type the following command and press enter:
copy /y c:\sethc.exe c:\windows\system32\sethc.exe
You can now exit Command Prompt and restart your computer normally. Pressing Shift five times at the login screen will now activate Sticky Keys instead of the Command Prompt.
Caution: Resetting a password using the Sticky Keys trick means you will lose access to encrypted files, encrypted email messages, and stored passwords for Internet Explorer and network resources. Remember to back up your important data regularly.