public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Find free drive letter in Cygwin?
@ 2023-08-07 16:52 Martin Wege
  2023-08-07 18:43 ` Brian Inglis
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Wege @ 2023-08-07 16:52 UTC (permalink / raw)
  To: cygwin

Hello,

What is the official cygwin way to find a free drive letter, which can
be used in a script to mount a drive?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Find free drive letter in Cygwin?
  2023-08-07 16:52 Find free drive letter in Cygwin? Martin Wege
@ 2023-08-07 18:43 ` Brian Inglis
  2023-08-07 21:17   ` Martin Wege
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Inglis @ 2023-08-07 18:43 UTC (permalink / raw)
  To: Martin Wege, cygwin

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.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Find free drive letter in Cygwin?
  2023-08-07 18:43 ` Brian Inglis
@ 2023-08-07 21:17   ` Martin Wege
  2023-09-15 13:00     ` Andrey Repin
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Wege @ 2023-08-07 21:17 UTC (permalink / raw)
  To: cygwin

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?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Find free drive letter in Cygwin?
  2023-08-07 21:17   ` Martin Wege
@ 2023-09-15 13:00     ` Andrey Repin
  0 siblings, 0 replies; 4+ messages in thread
From: Andrey Repin @ 2023-09-15 13:00 UTC (permalink / raw)
  To: Martin Wege, cygwin

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...

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-06 17:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-07 16:52 Find free drive letter in Cygwin? Martin Wege
2023-08-07 18:43 ` Brian Inglis
2023-08-07 21:17   ` Martin Wege
2023-09-15 13:00     ` Andrey Repin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).