Skip to content

Instantly share code, notes, and snippets.

@OlivierJM
Created December 26, 2023 07:54
Show Gist options
  • Save OlivierJM/38ff2e3a20bb0b0cad9071fac575a7fa to your computer and use it in GitHub Desktop.
Save OlivierJM/38ff2e3a20bb0b0cad9071fac575a7fa to your computer and use it in GitHub Desktop.
@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