2

I have an application which needs to be able to create folders in UAC-protected directories semi-automatically (the user will be there to approve the UAC notice, but I don't want to ask them to go do it themselves). The program does not otherwise need elevation; is there a common call that can be used to leverage Explorer's built in elevation prompts for this, or must I implement my own elevated helper component to do this?

bdonlan
  • 224,562
  • 31
  • 268
  • 324
  • Is there a reason you do not want to create at install time? The user already consented to run your installer elevated so there should not be another prompt if you do it in the installer. – Sheng Jiang 蒋晟 Jun 14 '11 at 20:48
  • We have users who, out of habit from previous versions of windows, put data folders in areas which require administrative access. These folders have variable components (dates, etc) as part of their path, so they cannot be created at install time. – bdonlan Jun 14 '11 at 21:36

1 Answers1

4

This is usually done by creating a separate process with the "runas" verb:

This process can perform any operations which require elevation.

Community
  • 1
  • 1
Cosmin
  • 21,216
  • 5
  • 45
  • 60