Re: use a drives guid instead of its letter - where is the drive root ?

Zaidy036 <[email protected]>
Newsgroups alt.comp.os.windows-xp,alt.windows7.general
Organization A noiseless patient Spider
Message-ID <[email protected]>
On 5/1/2024 7:03 AM, R.Wieser wrote:
> Hello all,
> 
> Using XPsp3 :
> 
> I have an USB drive, which I want to refer to by its guid - so that if its
> drive letter changes (because of other USB drives) I can still dependently
> talk to it (from within a script).
> 
> The thing is, when I use the result of "mountvol.exe" I can access the
> contents of any folder on the drive, but not the contents of its root.
> 
> Question: what do I have to write/do to access its root (do a "dir" on it) ?
> 
> 
> Reference:
> 
> https://superuser.com/questions/465730/access-to-a-disk-drive-using-volume-id-instead-of-a-drive-letter-in-windows
> 
> In the above the "start \\?\Volume{guid}\" method to open the drive doesn't
> work for me. However, "start \\?\Volume{guid}\foldername" does.
> 
> Regards,
> Rudy Wieser
> 
> 

This is what I use on Win 10 where xxxxx is the assigned name:

FOR /f %%D IN ('WMIC VOLUME GET DRIVELETTER^, LABEL ^| FIND "xxxxx"') DO 
SET "_HD=%%D"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.