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

后端 未结 4 612
死守一世寂寞
死守一世寂寞 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:41

    Can be done shortcutjs.bat:

    shortcutjs.bat -linkfile tst6.lnk -target "%cd%\myscript.bat" -adminpermissions yes
    

    -adminpermissions yes is for if you want to run the bat as administrator. You'll need the full path to your script.

    The 'run as admin' tick sets a binary flag in the .lnk file (21st character) and this what the script is doing too - reads it as binary steam and changes that value.

提交回复
热议问题