Linux – Windows 10 Linux Subsystem How to Change User Name and PC Name for Bash Console

bashwindows 10windows-10-v1607windows-subsystem-for-linux

When I first installed and ran Windows Linux Subsystem, console askded me to enter a new user name for bash. I input User. Now when I start bash in my console my username and PC name appeared at the beginning of the prompt, like

User@DESKTOP-TPQIRNP:/mnt/...

What should I do if I want to change my username for bash console? And PC name

Best Answer

According to therobyouknow's comment, LxRun.exe is deprecated now.

Please refer to Mitchell Van Manen's answer if you're using the new version of subsystem.

====================================================================

You should use LxRun.exe command locating in C:\WINDOWS\system32.

Here are two solutions, which are all run in cmd.exe instead of bash.

  • Use the command below to create a new user and set it as the default user:

    LxRun.exe /setdefaultuser NEW_USER
    
  • OR Uninstall Linux subsystem fully and reinstall it

    LxRun.exe /uninstall /full
    LxRun.exe /install
    

    The next time you reenter bash, it will prompt you to input username.