USB key (thumb drive usage of security things)

I have an interesting question. How can you make it so that when you try to open certain programs, you can’t run it with out the thumb drive being ppresent?