I know only one way to execute a program from memory device each time this device is connected to PC (in Windows): place file named
"Autorun.inf"[
^] in the root of the device and set your program as the run action. This is quite unreliable way, because autorun actions may be disabled by user in OS settings or blocked by antivirus software, but I doubt any another [simple] solution exists