I use ShellExecute (with Open) from within my program to launch other applications. A user has asked about being able to launch things that require admin privileges without the UAC dialog popping up.
Running my application as administrator works, but I was wondering if there was a way to do it without that. I’ve tried using “runas” instead of “open” but UAC still kicks in.
Tell the user to turn off UAC if they don’t want it
I imagine, if you can find a way to do that then every virus writer on the planet will be beating a path to your door.
Fair enough. The solutions that I saw (that didn’t work for me) must have been for earlier versions of Windows.
The only way I can think of to launch an app that requires Admin privileges without the UAC dialog popping up while the UAC is turned on, would be to have a service already running that has Admin privileges and have your application signal the service to ShellExecute the app you want to launch.
The service would have to be one you write yourself so that no-one else would know how to use it.
Could also make it launch a Windows Scheduled Task that already allows elevation as it is set to “Run with highest privileges”
Running the task
C:\Windows\System32\schtasks.exe /RUN /TN "Name of folder\Name of task "
You would need an installer or something with admin privileges to create the task in the first place.
via SCHTASKS.EXE /CREATE