As the title says, I am wondering if there is a way to start my program in administrative mode using a function, code, command of some sort included in it. The reason is, my program cannot delete a file without having to be run as an administrator. and yes a simple way of solving this would be to edit the properties of the exe so that it uses UAC to start as admin but I have to distribute the source code for my reviewers to compile it and wanted to save them the trouble.
Any comments,solutions etc are appreciated, thanks.
CodePudding user response:
You could use PowerShell for this:
PowerShell Start yourprogram.exe -Verb Runas
This should be portable enough to run on most Windows systems.