Siddhant
Siddhant

Reputation: 581

Run cmd in admin mode using a batch file

I have a msi installer that needs to be run in silent mode. For that I need to run the installer in silent mode through an elevated command prompt. How can I launch the cmd in elevated mode and then run the command to execute installer from that elevated cms using a batch file?

Upvotes: 0

Views: 5089

Answers (2)

If you want all programs (including command prompt) to run in admin mode by default, then disable UAC by making enableLUA=0 in registry. Note that this change will prompt for system restart.

EnableLUA can be found under HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System.

Once the system comes up, then all programs will run in elevated (admin) mode by default.

Upvotes: 1

r3ap3r
r3ap3r

Reputation: 2815

  1. Make a batch file and call the msi installer from it.
  2. Then create a shortcut to the batch file.
  3. Right click on the shortcut -> Properties -> Shortcut tab -> Advanced.
  4. Click Run as administrator. Execute the batch script from the shortcut.
  5. In the scheduler, give the path to this shortcut.

Upvotes: 1

Related Questions