Re: use a drives guid instead of its letter - where is the drive root ?
VanguardLH <[email protected]>
| Newsgroups | alt.comp.os.windows-xp,alt.windows7.general |
|---|---|
| Organization | Usenet Elder |
| Message-ID | <[email protected]> |
Zaidy036 <[email protected]> wrote: > 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. > > 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" I'll have to remember using wmic. In a similar for-loop, I use fsutil.