DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 53BGoY703874455 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 53BGoY703874455 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=ZMhZTo8f X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD499382FCBA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1744390233; bh=E41DWQOSFEXogNJuKxo/2d9GGKbhrMehyUpY41Lc4WQ=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ZMhZTo8f9fmJZpuAJasN+ziX9c6FQ8IutRes2gDtKIQKQVPZ0D2+7OTrYtbhZzTbW Xudu4KjSzF9NVuimmjbmC/fmnQcDc5lScc/uWjlCdZ4TNJl4hrSrRWJML8J6H4C0Cj e8il0R5TTE7KqkQZnGOeJ6yO/yOQTZd89zH6FQXQ= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C1F7384D1AC ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5C1F7384D1AC ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744390204; cv=none; b=X1bAaufQ/Iqfjg0oWUOkN6iNtEWs/tzG4BjVzWnXWpA5/OEcZG4eGHKKnGqclQbedi85Amn82sQOwMkdfF37TlgqWqG0XFQk5W2wCElg+a1x5QOlF/PtuMUG1YWvtq+LdG/mHEbydp2b098RwG/WNO5Ea71NDf3uywtbCiqEZS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744390204; c=relaxed/simple; bh=1Mpoio6SoF63TwcS9DK1Tk60kJ24XLHd7JBu4kUZwy4=; h=DKIM-Signature:Date:From:Message-ID:To:Subject:MIME-Version; b=WWJExE361ogKRCRk6BXBIKxa+l9yiomzZg0mLy0jxo60f09gTdnNcIvK8n+5wV5Xug3EbbWaaE70juqrvQzZ6rJ35ZOCrpRdR2bS0AYQ7qexLCP5FZXTTKg1gQv03+OVBRdrbseBA3w2WcgreT0YBjNwAdRiN1ANXSJw83JZWtE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C1F7384D1AC X-Yandex-Fwd: 1 Date: Fri, 11 Apr 2025 19:37:25 +0300 X-Mailer: The Bat! (v9.3.4) Professional Message-ID: <1783915490.20250411193725@yandex.ru> To: Mark Liam Brown , cygwin AT cygwin DOT com Subject: Re: Modify bash shell script so it runs in elevated admin mode on Win explorer double click? In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrey Repin via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Andrey Repin Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Greetings, Mark Liam Brown! > How can I modify a Cygwin bash script so it runs in elevated > Administrator mode when someone double-clicks it in Windows Explorer? Add a block that runs an admin only command and check for exit code. The `net session` or `openfiles` commands are a good candidate for a target of such check. Smth. along the lines of if ! openfiles > /dev/null 2>&1; then # Some command to restart the program elevated exit 1 fi Though, I'm using takecommand's free runtime (TCC-RT), which has an explicit START /ELEVATED command, and I'm using a wrapper for such tasks. Though, in hindsight, just creating an .LNK with "run as administrator" checkbox set in properties should suffice. -- With best regards, Andrey Repin Friday, April 11, 2025 19:26:03 Sorry for my terrible english... -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple