As the title says, is it possible to launch an exe or run a command when I plug my raspberry pi into my computer so that the program launches ON THE PC/MAC. I know you can auto boot something when you plug in a usb drive but I’m not sure how you would achieve the same thing with the pi.

  • 1
    What do you mean by plugging the raspberry pi into computer? Pls be specific. How you are connecting your raspberry pi to the computer? Nov 23, 2019 at 11:53
  • My apologies! Just a simple 3.0 USB cord Nov 23, 2019 at 14:37
  • @user2544427, to launch a program on the PC/MAC, you'd have to run something on that computer. I reccomend a Python script for that, Mac already has Python2 preinstalled. Of course, the RPi could emulate some sort of media device (which would be complicated) but would only allow a default dialog.
    – user96931
    Nov 23, 2019 at 18:37
  • Welcome to Raspberry Pi :-) But running programs on a PC/MAC is off-topic here on Raspberry Pi. Please take the short Tour and visit the Help Center to get an idea how things work here. You should ask in an appropriate forum.
    – Ingo
    Nov 23, 2019 at 18:53

1 Answer 1


I don't have an answer but I do have an alternative I'm probably going to try myself.

At the end of the day the goal is to plug in a device and require little to no setup correct?
My idea is to connect the raspberry pi in gadget mode using the gadget_cdrom library.
Then you can write a program in python or something to make it cross platform, provide an exe for windows and add an autoplay.inf see how to here.

I'm pretty sure most pc's don't allow for autorun anymore but at least it'll allow anyone to just click the drive icon and start the program on windows.

Then in your python app you can just ssh to raspberrypi.local or something like that. And on the raspi side create a user that can only run one ssh command for the python program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.