Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I configure my PC to execute a batch file every time any USB drive is inserted? I would like to use regedit, if possible.

share|improve this question

migrated from stackoverflow.com Jun 6 '11 at 19:40

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Since you mentioned batch file scripting, I'm going to assume a windows platform. You can write an application that handles these events: WM_DEVICECHANGE

I imagine you can have it running in the background as a daemon and have it call your batch file upon the right conditions.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.