Although that is possible, it's kinda hard to do that by yourself and it's for more advanced users. It requires lots of knowledge on low level programming and hardware.
It seems that what you want to accomplish here is the reprogramming of a USB flash drive's firmware to act as an HID (Human Interface Device). This is called a bad USB
.
I found a tutorial called
How to Make Your Own Bad USB. The tutorial introduces you in more detail to what it is a bad USB
and explains how to create one in Windows.
But the exploit described in this tutorial doesn't work on all USB flash drives. It has some specific requirements.
From the tutorial intro:
Most common USB flash drives are exploitable due to the "Bad USB
vulnerability". This allows us hackers to reprogram the
microcontroller of them to act as a “Human Interface Device” (HID) /
keyboard and perform custom keystrokes on our target machine. This
scenario is often called “HID Payload Attack”, since you have to hand
over your script to the Bad USB for the execution ( more on that later
). Even though almost every USB flash drive is exploitable, only a way
to reprogram “Phison” microcontrollers has been released yet.
I haven't tried the tutorial, so I can't tell you if it will work, but nothing as trying it by yourself :)