This article introduces a method to output the Windows username from the WSL Linux Bash command line, rather than the WSL Bash Linux username.
echo $(cmd.exe /c “echo %USERNAME%”)
The above command is executed in the following steps:
cmd.exe /c “echo %USERNAME%”is executed, and the Windows username is output.echo $(cmd.exe /c “echo %USERNAME%”)is executed, and the Windows username output in step 1 is displayed.