How do I get the current username in Windows PowerShell?

后端 未结 15 2726
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 01:35

How do I get the current username in Windows PowerShell?

15条回答
  •  抹茶落季
    2020-11-28 02:08

    Just building on the work of others here:

    [String] ${stUserDomain},[String]  ${stUserAccount} = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name.split("\")
    

提交回复
热议问题