如何获取非管理员用户的环境变量? [英] how get environment variables of non-admin user ?

查看:226
本文介绍了如何获取非管理员用户的环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个使用Admin特权执行的桌面应用程序.当该应用程序由非管理员用户(通过使用管理员权限提升应用程序)(例如标准用户)运行时,我无法获取标准用户(或已登录用户)的环境变量,而是该应用程序返回管理员用户环境变量.如何解决此问题.请帮助...

Hi,

I have a desktop application that is executed with Admin privileges. When this application is run by a non-admin user (by elevating the app with admin rights) say standard user, I am unable to get the standard user''s (or logged on user''s) environment variables, instead the application returns the Admin users environment variable. How can this issue be resolved. Please help...

推荐答案

环境变量是用户特定的,并在该用户配置文件中定义,当您使用RunAs时,Windows正在安全地加载应用程序该用户的上下文和个人资料,因此您将无权访问原始登录用户.
Environment variables are user specific and defined in that users profile, when you are using RunAs, Windows is loading the application in the security context and profile of that user, so you will not have access to the original logged-in user.


这篇关于如何获取非管理员用户的环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆