Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is there a way to start program in administrative mode using a command?

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You could use PowerShell for this:

PowerShell Start yourprogram.exe -Verb Runas

This should be portable enough to run on most Windows systems.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading