How to create a shortcut to launch an App with admin privileges from the cmd-line?

后端 未结 4 639
死守一世寂寞
死守一世寂寞 2021-01-02 06:19

I have an installer (Inno-Setup) that installs my application to a path defined by the user. At the end of the install routine i want to create a shortcut that starts the ap

4条回答
  •  再見小時候
    2021-01-02 06:50

    The "Run as admin" is a property of the executable, not the shortcut. You should add the required manifest that makes Windows prompt for elevation.

    To do this on Windows XP, you will need to use the runas verb with ShellExecute() to run as a different user, but this will remove any ability to access the local profile. This can be done from your exe when it finds it's not running with full admin access.

提交回复
热议问题