Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My friend code for my project and I'm practical aspects

As soon as I connect Memory Stick to the file system can run

I got to run autorun.inf
I do not need to click on the file or Autoplay I do not want to be

I would run file as soon as the connect Memory Stick
Posted
Updated 6-Nov-11 6:13am
v3

I think what you are after is an autorun.inf[^] file.

This allows you to specify actions which can be performed when a CD or USB stick is inserted. On later versions of Windows this will open a box asking the user what to do. On earlier versions it will just do whatever is in the autorun file.

Try it out. Create a new file on the USB stick and call it autorun.inf
open the file in notepad, or any other text editor and past the following into it.
[autorun] 
open=C:\Windows\System32\cmd.exe


Unplug the USB stick and plug it back in and it should either open a command prompt or ask to run 1.

Also, please don't lock your question. Some people here don't speak English very well. They may not be able to understand your question because your English is not great either.
(Sorry if that sounds like an insult, I only speak 1 language so you are probably doing better than me)

EDIT:
After reading your question again it seems that you want something that can run automatically without the use of autorun.
This is not possible. Imagine if a virus was to take advantage of this function. It could spread by USB sticks easily.

There was in fact a virus a while back which exploited a flaw in the autorun to allow this, however it has since been patched, and this is a bad thing to do. Virus scanners will detect your USB stick as malicious and delete the code.
 
Share this answer
 
v2
Comments
Manfred Rudolf Bihy 6-Nov-11 10:30am    
I understood that OP wanted to do this without autorun.inf, which IMHO is impossible to do.
Andrew Brock 6-Nov-11 10:31am    
Yeah, I just got that after reading it again. Thanks.
I must disapoint you, but what you want cannot be done. It could be a done with autorun.inf, but the system where the USB stick gets inserted could have this turned off as part of a security policy[^].

Cheers!

—MRB
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 6-Nov-11 11:16am    
All of a sudden, good negative advice, my 5. :-)
The thing is: this policy is very reasonable and should always be applied. OP is not the only one who sticks Sticks in the stick slots. :-)
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900