Method 1: Using pre-written password in file.

@echo off

net user %username% 123

write the above code in the notepad and save it as filename.bat, make sure you are adding the extention (.bat)

Explaining the code : net user %username% : is the predefined command of the windows by which, we can change the password of the current user. and “123” is the password what you want to set.

After that run this file as administrator rights

Method 2 : Using custom password entered by the user

@echo off
set /p newpass=Enter new password
net user %username% %newpass%
pause

write the above code in the notepad and save it as filename.bat, make sure you are adding the extention (.bat)

Explaining the code : set /p newpass=enter new password : is use for prompting the message to the user for asking new password that will be set.

After that run this file as administrator rights

Leave a Reply

Your email address will not be published.