Created
January 15, 2025 04:55
-
-
Save hamdymohamedak/72ed73ed3f483330f522a3dfa6b3748e to your computer and use it in GitHub Desktop.
this file can change the windows username from CMD replace "NEW NAME "with your name , the file run as adminstrator by default
This file contains hidden or 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 | |
| :: Check if the script is running as Administrator | |
| openfiles >nul 2>&1 | |
| if %errorlevel% neq 0 ( | |
| echo This script must be run as Administrator. | |
| echo Restarting the script as Administrator... | |
| powershell -Command "Start-Process cmd -ArgumentList '/c, \"%~f0\"' -Verb runAs" | |
| exit /b | |
| ) | |
| :: Get the current username | |
| for /f "tokens=2 delims=\" %%a in ('whoami') do set currentUser=%%a | |
| :: Change the username to "askander" | |
| net user %currentUser% /fullname:"NEW NAME" | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment