How do I query the current username on a Windows platform from within MATLAB?

I want to query the current username on the Windows platform from within MATLAB.

 채택된 답변

The name of the current user is specified by the Windows %USERNAME% system variable. The contents of the %USERNAME% system variable may be queried from within MATLAB by using the GETENV or DOS functions:
username=getenv('USERNAME')
or
[s,username]=dos('echo %USERNAME%');

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

릴리스

R14SP2

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by