Hi guys,
I've not really used FINDSTR before, I did have an example of it's usage which I could have copied over but I can't find it... 😭
the SS64 page is confusing me so I've come here;
I'd like to be able to show a list of drives on the computer AND the name of the drive (so say if I'd named my usb stick to "goggleStick")
Given how if I put that stick into another computer, it's drive letter may be different, but it's name would be the same. I'd like to be able to use some sort of find command on a list of drives, to locate it by it's name, then get the drive letter out of the list, and assign that to a variable.
Current research into displaying a drive list:
I found diskpart list volume (from here)
unfortunately it's not possible to simply type in "diskpart list volume" as diskpart must first run, and seperately have "list volume" typed in. This would interrupt a batch script whilst diskpart is running. So that's out.
WMIC is good!
I found on the same site the suggestion of
"wmic logicaldisk get deviceid, volumename, description"
to show some drive information, for some reason the output came in the order
"description, deviceid (which was the drive letter), volumename (e.g. goggleStick)"
I can cut this down to "WMIC logicaldisk get deviceid, volumename"
which gives firstly the drive letter, then the name, one per line.
then I assume somehow pipe this into a findstr command, which puts it into a variable, then use partial variables to extract the first letter, which will be the drive letter, so I can reference the usb stick's files.
"%drivelett%:/folder/file.type"
Thanks for any help! 🤗
I've not really used FINDSTR before, I did have an example of it's usage which I could have copied over but I can't find it... 😭
the SS64 page is confusing me so I've come here;
I'd like to be able to show a list of drives on the computer AND the name of the drive (so say if I'd named my usb stick to "goggleStick")
Given how if I put that stick into another computer, it's drive letter may be different, but it's name would be the same. I'd like to be able to use some sort of find command on a list of drives, to locate it by it's name, then get the drive letter out of the list, and assign that to a variable.
Current research into displaying a drive list:
I found diskpart list volume (from here)
unfortunately it's not possible to simply type in "diskpart list volume" as diskpart must first run, and seperately have "list volume" typed in. This would interrupt a batch script whilst diskpart is running. So that's out.
WMIC is good!
I found on the same site the suggestion of
"wmic logicaldisk get deviceid, volumename, description"
to show some drive information, for some reason the output came in the order
"description, deviceid (which was the drive letter), volumename (e.g. goggleStick)"
I can cut this down to "WMIC logicaldisk get deviceid, volumename"
which gives firstly the drive letter, then the name, one per line.
then I assume somehow pipe this into a findstr command, which puts it into a variable, then use partial variables to extract the first letter, which will be the drive letter, so I can reference the usb stick's files.
"%drivelett%:/folder/file.type"
Thanks for any help! 🤗
Keep me fed and alive at Uni:
Bitcoin: 16cwoYXfhaK6V5c8kJKn9SBMtDUARUs7BS
I'll draw terrible art in paint.NET for you, on request, in return <3
Bitcoin: 16cwoYXfhaK6V5c8kJKn9SBMtDUARUs7BSI'll draw terrible art in paint.NET for you, on request, in return <3


![[Image: NlBXyi4.png]](https://i.imgur.com/NlBXyi4.png)