This question already has an answer here:

I want to perform one security mechanism, but I don't know whether it is possible.

I want to Shutdown/Turn Off PC/System when any USB device attach to it.

marked as duplicate by Tog, CharlieRB, Moses, Mokubai, Heptite Dec 26 '13 at 3:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • What version of Windows ? – Lawrence Dec 24 '13 at 5:53
  • @Lawrence -It's Windows 7 and 8 also. – Java Curious ღ Dec 24 '13 at 6:13

First of all, make sure you know what your doing, shutting down a computer when any USB device attaches to it could put you in a hard spot when you try to connect your Keyboard for example.

With that disclaimer out of the way, Windows Scheduler would be the easiest way to accomplish this. Write a little batch script that shuts down the computer:

@echo off
shutdown \p

And set a scheduled task using Windows Scheduler to run that batch script every time a USB device is inserted. And your done!

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