Hi All; In my installer i put a .bat in place and after everything else is done i want to run it. However this .bat needs to be run as administrator because it has to setup some inbound firewall rules.How can i do this in the installer or do i have to have the installer run as administrator?

Thanks Shawn

asked 17 Nov '11, 15:04

shawn's gravatar image

shawn
5668
accept rate: 0%


If the installer is not running elevated, the only way to run the .bat as administrator may be create a shortcut requesting it to be launched as administrator and then execute it:

<createShortcuts>
    <destination>${installdir}/</destination>
    <shortcutList>
        <shortcut>
            <comment>Run .bat as admin</comment>
            <name>run</name>
            <runAsAdmin>1</runAsAdmin>
            <windowsExec>${installdir}/script/run.bat</windowsExec>
            <windowsExecArgs></windowsExecArgs>
            <windowsPath>${installdir}</windowsPath>
        </shortcut>
    </shortcutList>
</createShortcuts>
<runProgram>
   <program>cmd</program>
   <programArguments>/C start /W "" "${installdir.dos}/run.lnk"</programArguments>
</runProgram>

Could you check if that solves your issue?

link

answered 18 Nov '11, 04:42

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×36
×22
×15

Asked: 17 Nov '11, 15:04

Seen: 3,673 times

Last updated: 18 Nov '11, 04:42