In Windows 10 V1703, now right-click on Start button, there shows "Windows PowerShell (Admin)" which replaced old "Command Prompt (Admin)".
In a PowerShell window, can run well the below command:
net user $env:UserName
Now in Cortana's search box type "cmd", then right-click "Command Prompt", click "Run as administrator", open a "Command Prompt (Admin)" window,
can run well the below command in it:
net user %UserName%
This indicates that the environment variable $env:UserName in PS is equal to %UserName% in CMD.
And, in a "Command Prompt (Admin)" window, can run well the below two commands in it:
Get the current account's username:
wmic useraccount where name="%UserName%" get Name
View a specific user account info list:
wmic useraccount where name="[username]" list
for example, list my user account:
wmic useraccount where name="Trybird" list
Now in a PowerShell window, I try to run the following commands, but all have failed:
wmic useraccount where name="$env:UserName" get Name
wmic useraccount where name=$env:UserName get Name
wmic useraccount where name="Trybird" list
wmic useraccount where name=Trybird list
Please tell me,
which PowerShell scripts are equal to the CMD commands --
wmic useraccount where name="[username]" list
and
wmic useraccount where name="%UserName%" get Name?