Auto run script on USB device | Unix Linux Forums | Shell Programming and Scripting

  Go Back    

Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Auto run script on USB device

Shell Programming and Scripting

Closed Thread    
Thread Tools Search this Thread Display Modes
Old 10-19-2010
cbreiny cbreiny is offline
Registered User
Join Date: Oct 2010
Last Activity: 8 February 2011, 5:49 PM EST
Posts: 17
Thanks: 4
Thanked 0 Times in 0 Posts
Auto run script on USB device

Okay I want to write a script that I put on a jump drive. And when you plug the USB in this script executes. How would i go about doing this? I don't care what the program does right now. I just want to know how this would be done. Any ideas?
Sponsored Links
Old 10-19-2010
Chubler_XL's Avatar
Chubler_XL Chubler_XL is offline Forum Staff  
Join Date: Oct 2010
Last Activity: 29 January 2015, 9:57 PM EST
Posts: 3,093
Thanks: 117
Thanked 1,004 Times in 941 Posts
Will the computer your intending to run this from have a shell to execute your script? If not you will need to put a copy of the shell on the USB drive too.

Use autorun.inf:

open=ksh -c myscript
action=Invoke MyScript in ksh shell
label=My USB Application

Note: This is a popular way for viruses to propagate themselves, so a lot of computers are now setup to not autorun USB devices. This may mean you user will still need to manually start the script so it's probably best to put a shortcut that does that for them (eg Setup.lnk or Install.lnk).
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to Install jdk.bin using shell script with auto yes/no? sandeepbharmori Shell Programming and Scripting 6 03-08-2010 09:15 AM
Script to auto restart a service ajazshariff HP-UX 2 02-19-2010 03:26 AM
auto login script mohankasi Windows & DOS: Issues & Discussions 1 02-03-2009 06:23 AM
Auto answer ( Yes or No) from unix script Nayanajith Shell Programming and Scripting 3 08-22-2006 02:29 AM
Auto Alias Script coolboarderguy Shell Programming and Scripting 3 12-25-2005 09:11 AM

All times are GMT -4. The time now is 12:05 AM.