Created
December 26, 2023 07:54
-
-
Save OlivierJM/38ff2e3a20bb0b0cad9071fac575a7fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enabledelayedexpansion | |
:: Prompt for username | |
set /p username=Enter the username for which you want to change the password: | |
:: Prompt for new password | |
set /p newPassword=Enter the new password: | |
:: Change the password | |
net user !username! !newPassword! | |
:: Check if the password change was successful | |
if %errorlevel% equ 0 ( | |
echo Password change successful for user !username!. | |
) else ( | |
echo Failed to change password for user !username!. | |
) | |
endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment