Reputation: 167
I want to create a batch file when launched asks the user to change the current administrator password.
Step 1: User logins
Step 2: Batch file runs displaying message "Please change Administrator password"
Step 3: user types in new password
Step 4: sets new password for Administrator account
Step 5: deletes batch file
Step 5 must not happen unless the user changes password. I know how to set a task schedule for it to run just not sure what the code inside the .bat file needs to be.
Upvotes: 1
Views: 4405
Reputation: 1351
@echo off
Set "password123="
echo "Please change Administrator password"
set /P password123=Enter your new password:
If Not Defined password123 goto :exit
net user administrator %password123%
del "%~f0"
:exit
exit
Upvotes: 2