Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to know if anyone can help me with my batch script. The program will have to detect under which letter the usb drive is connected (there is only one) then copy all the data. The different steps I thought of (tell me if I'm wrong)

1. detect under which letter the usb drive is connected

wmic logical where drivetype=2 get name
is the command the right one ?

2. store this letter in a variable

Here I need your help because I can't store the letter in the variable

3. copy the data

with xcopy ?

What I have tried:

More informations:
This code will be used for a device such as bash bunny or rubber ducky for example (this is a challenge I set myself). For those who don't know these devices pretend to be a keyboard and execute previously defined commands (like an autorun).
The way it works is as follows:
- a usb key is connected to the computer
- when I plug this device (bash bunny for example) it will execute the following code: find under which letter the usb key is connected and then copy the entire data.
I hope I have been clear enough. If not, please let me know.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900