How can I auto-elevate my batch file, so that it requests from UAC administrator rights if required?

后端 未结 15 1207
陌清茗
陌清茗 2020-11-22 03:59

I want my batch file to only run elevated. If not elevated, provide an option for the user to relaunch batch as elevated.

I\'m writing a batch file to set a system v

15条回答
  •  情书的邮戳
    2020-11-22 04:11

    Although not directly applicable to this question, because it wants some information for the user, google brought me here when I wanted to run my .bat file elevated from task scheduler.

    The simplest approach was to create a shortcut to the .bat file, because for a shortcut you can set Run as administrator directly from the advanced properties.

    Running the shortcut from task scheduler, runs the .bat file elevated.

提交回复
热议问题