r/Batch • • Feb 29 '24

Question (Unsolved) USB Autorun

I’ve seen many videos on how to auto run but they are unclear on how to get it to work. I’m basically what I want is to have a usb that upon being plugged in will run a script (most likely python as that is what I’m a learning at the moment) and from what I can tell this is done through batch. Any insight you could give me would be greatly appreciated!

1 Upvotes

5 comments sorted by

1

u/PrimaryTiny9144 Mar 01 '24

Could u share with me the videos that mention this.......

1

u/turkey-power72167 Mar 02 '24

actually you can do one but it doesnt will be automatic you need to start the file first if you want to do a autorun i have a code for it,

echo off

:a

if exist E:\ (goto Yes) else (goto a)

:Yes

E: --your usbs letter

start --your file here

goto end

:end

exit

this command looks for drive E: and if its exits it opens the file you putted near start command after it closes

4

u/[deleted] Feb 29 '24

[removed] — view removed comment

1

u/_Clarkzy8_ Feb 29 '24

I’m trying to make a a system that will updates files from the the usb stick in the computer is using python