It is possible to change the password of a PC with the command prompt as long as you log in with an administrator account. On the other hand, this operation is impossible under a simple user account. In macOS, it is also possible, with the same caveat, to change your Mac password using the Terminal application.
Steps
Part 1 of 2: Run the Command Prompt

Step 1. Open the Start menu on your PC
To do this, click on the Windows logo in the lower left corner of the screen or on the ⊞ Win key on your keyboard. The cursor is then activated in the search field of this menu.

Step 2. Type command prompt
In a fraction of a second, you will see the access icon at your command prompt at the top of the results list.
- In Windows 8, to display the search bar, you must drag the mouse cursor in the upper right corner of your screen, then click on the magnifying glass that appears.
- In Windows XP, click on the application Execute on the right side of the menu To start up.

Step 3. Right click on the command prompt
The icon is a black screen. Right click on the mention command prompt to open a context menu.
- Under Windows XP, you will have to type command prompt in the window Execute.

Step 4. Click Run as administrator
The option is at the top of the menu. By choosing it, you run the command prompt with all the privileges (write, read) of the administrator.
- You must confirm your choice by clicking on Yes at the right time.
- In Windows XP, simply click on OK to run the command prompt.
Part 2 of 2: Change a computer password

Step 1. Type net user in the command prompt
Remember to put a space between the two words: this is important!

Step 2. Press Enter
The more or less long list of user accounts for this computer is then displayed.

Step 3. Find the name of the account you want to edit
If this is the password for the administrator account that you are changing, you will find it, on the left, under the mention Administrator. If it is that of a user account, it will be, on the right, under the mention Guest.

Step 4. Type net user name * at the command prompt
You will replace name with the name of the account whose password you want to change.
The name of the account to type must be absolutely identical to the one that appears above in the command prompt

Step 5. Confirm by pressing Enter
The command executes and you should see the following line appear: Enter a password for the user.
-
If it is a set of lines that is displayed with the mention at the top The syntax of this command is:, type net user Administrator * for an administrator account and net user Guest * for a guest account.

Step 6. Type a new password
The keystroke does not appear, be careful not to accidentally press the Caps Lock key, the password is case sensitive.

Step 7. Press Enter
You will be asked to enter your password again.

Step 8. Retype your password
Since the word is not clear, be extra careful when typing, the case sensitivity is still there.

Step 9. Press Enter
If the two passwords match, you will see sign up: The order completed successfully under the second password. For subsequent connections, you will of course have to use this modified password.
Advice
- If you don't have the option to log in as an administrator, you might not even have access to the command prompt.
- In Windows, it is possible to reset the administrator password by launching the Windows Recovery Console.
- Also, try turning off the power to your PC without turning it off. A procedure is started because of the bad extinction. Don't go to the end of the process: halfway through you will see a link to a TXT file at the bottom which, if you click on it, will open in Notepad. This file must be modified to disable the functionality of sticky keys (combination keys). When the administrator prompt appears, press the shift key 5 times to relaunch the command prompt. You can then reset your password.