This is my first post so cut me some slack.
To start out, this script CANNOT use vbasic scripts or the wmic command.
It needs to be done in CMD prompt.
I have a USB Rubber Ducky (USB programmable HID/Mass storage device) and I need to run a command to find the drive letter of the device named 'DUCKY' mounted. And set the drive letter as a variable. So I can run or open other files on the device.
I found out, some bare windows installs CANNOT run this command to find the device 'DUCKY'
for /f %d in ('wmic volume get driveletter^, label ^| findstr "DUCKY"') do set myd=%d
Here's the output:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\X>for /f %d in ('wmic volume get driveletter^, label
^| findstr "DUCKY"') do set myd=%d
'wmic' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\X>
I need this command to be short and compatible with most old and new Windows OS.
So I tried to venture this quest on my own.
Here's my progress:
echo list volume | diskpart | findstr "DUCKY"
Output:
C:\Documents and Settings\X>echo list volume | diskpart | findstr "DUCKY"
Volume 2 F DUCKY FAT Removeable 239 MB
C:\Documents and Settings\X>
Now all I need to do is extract the Drive letter (witch changes from system to system) into a variable. THATS IT.
Ive searched weeks for this answer and never found it solved by using the basic command prompt. I made lots of progress but at this point my skill are at its limit.
Please help me find the answer!