X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03A093858C78
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1699291918;
	bh=2tHmNZSqfBqf8qWSQMcV8xqAa6gDqr3lmWZ4/BOPdVY=;
	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=H8EuRESphLeTqm6Sg7+eZtjhoJTGoVbpREQ2S6Dw4XdvHqucifExP57h46FpwWdzo
	 odexJOLZZf/d9N1d2kRDwqUussd7IqQo8YRGBUSloVqAryldvkapiLIvkrcFkl6OC0
	 Y83zFEBtl0DcnVp4+tEF1GVX4BTEJrxtbf7XeagY=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 43039385840E
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 43039385840E
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699291856; cv=none;
 b=sbO6JGSuPy7RnhixYzLi+7AnOgrSrpvpiZBuoSCxungiARm5/lhkMU07nA5+fdK8x1plvtyZDWOmBrLQR0b79wwwpLTkeTVZ3W1aKSNif6cRbi2XXoGKNT6FWuKmVDmBDqF12oiR/RCAfGbstFLsD+jAK5a47cW/8UL8S/bRl+4=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1699291856; c=relaxed/simple;
 bh=I7mfiqyPUsFhweWRrXGxqxDEM67BobHq01OGEotqHWI=;
 h=DKIM-Signature:Date:From:Message-ID:To:Subject:MIME-Version;
 b=nqAk3kpiUM8STm0V87DkPfrDQgaCt+G7Me8QAOe3appA0OZvxI3049EGtXO9KA4yD7CmTq9MVfFBMVxPC+/p5ujPQZLylGwFKINUhwU82oAjFdTVlDFTxHoa1fUZhWkNuLRP45X9ESmT7V9x9Kd7uUMIhfYnc/OVJ8AofxGNAC4=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Yandex-Fwd: 1
Date: Fri, 15 Sep 2023 16:00:00 +0300
X-Mailer: The Bat! (v9.3.4) Professional
Message-ID: <517345390.20230915160000@yandex.ru>
To: Martin Wege <martin.l.wege@gmail.com>, cygwin@cygwin.com
Subject: Re: Find free drive letter in Cygwin?
In-Reply-To: <CANH4o6MVbfdQ8uQoS0US1i=Y7zEJ3fkiYdfGaYpYh-De6i5P6A@mail.gmail.com>
References: <CANH4o6NwvX30K=X_06vh0w5MYCPgcRXZKJL91aX1UbnWsAJe4Q@mail.gmail.com> 
 <8e62adb7-34b8-2d54-91f5-4f63cfd9d3fe@Shaw.ca>
 <CANH4o6MVbfdQ8uQoS0US1i=Y7zEJ3fkiYdfGaYpYh-De6i5P6A@mail.gmail.com>
MIME-Version: 1.0
X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00, DATE_IN_PAST_96_XX,
 DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM,
 KAM_THEBAT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,
 RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Andrey Repin via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Andrey Repin <anrdaemon@yandex.ru>
Content-Type: text/plain; charset="utf-8"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 3A6HW9MW009501

Greetings, Martin Wege!

> On Mon, Aug 7, 2023 at 8:43 PM Brian Inglis <Brian.Inglis@shaw.ca> wrote:
>>
>> On 2023-08-07 10:52, Martin Wege via Cygwin wrote:
>> > What is the official cygwin way to find a free drive letter, which can
>> > be used in a script to mount a drive?
>>
>> Just use the Windows UNC network path directly on Cygwin with '/' not '\'.
>>
>> For Windows, it may still be NET USE * \\... but have not used it in decades!
>>
>> Cygwin should pick it up and automount it under /proc/cygdrive/?/ but see
>> disclaimer above.

> So it would be a valid solution in bash to loop from a-z in
> /proc/cygdrive/$letter/ and see whether this is a dir, right?

If you want a temporary bind, A: and B: are often free on modern systems.
Or you could just make a junction to a directory instead.

mklink /J $( cygdrive -aw $(mktemp …) ) \\server\share


-- 
With best regards,
Andrey Repin
Friday, September 15, 2023 15:57:10

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

