简体   繁体   中英

Java - get windows logged user

I'm logged in to windows 10 with a regular user (no admin privileges). I run my java application with admin privileges, but I need to get the normal logged-in user path (that's unprivileged) at runtime. System.getProperty ("user.home") only returns me the admin user path. Can anyone help me solve this problem?

Thanks a lot

Change "user.home" to "user.name" . However, if you run the program as Administrator that is what it will return.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM