问题
Hi when i try to open my app in win-xp it works fine but when i try it on win7 it says access to path (path location) is denied unless i open it as administrator so how can i give my app administrator rights without promoting
Thank you
回答1:
You can't gain administrator rights on a system with UAC without passing through UAC elevation.
Your options are:
- Manifest your app so that it always runs as administrator. The user sees the UAC dialog every time they start the app.
- Separate the part of the app that needs admin rights into a separate process and just require elevation for that part.
- Re-work your app so that it doesn't need admin rights.
Of these options you should prefer 3. If you can't achieve that then 2 is better than 1.
来源:https://stackoverflow.com/questions/7263918/request-uac-elevation-c-sharp