X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=0.9 required=5.0 tests=BAYES_20,SARE_MSGID_LONG45 X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <20100416014318.GA19127@panix.com> References: <20100416014318 DOT GA19127 AT panix DOT com> Date: Fri, 16 Apr 2010 00:53:37 -0400 Received: by 10.216.171.7 with SMTP id q7mr1225090wel.40.1271393617262; Thu, 15 Apr 2010 21:53:37 -0700 (PDT) Message-ID: Subject: Re: scripting elevated privilege on Windows 7 From: Robert Pendell To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Note-from-DJ: This may be spam On Thu, Apr 15, 2010 at 9:43 PM wrote: > > I am dealing with Windows UAC for the first time. From a script, I would > like to launch a process with elevated (administrative) privilege. I > can accept that Windows will pop up a modal dialog box confirming the > elevated privilege. > > Is there an existing utility in Cygwin or elsewhere. > > An example of what I would like: I have a program named backall that > I want to execute with administrative privelege. I am looking for some > command xxx that I could invoke from a shell script as > =C2=A0 =C2=A0 =C2=A0 =C2=A0xxx backall > > Does such a utility exist? If I wanted to enhance cygstart to support > this feature, which Microsoft API should I use? > I took a look at the source code as well as did some research and luckily ShellExecuteEx already has a provision for this. Cygstart also has a parameter that will allow for this although there is no quick option for it. I have tested and verified. It will not path search so you must specify the file location or be in the folder where the program resides. Run the following command and it will prompt for elevation. cygstart --action=3Drunas command Replace command with the actual command. This is an example and it does prompt and elevate. cygstart --action=3Drunas /cygdrive/c/windows/system32/cmd.exe Robert Pendell shinji AT elite-systems DOT org CAcert Assurer "A perfect world is one of chaos." -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple