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
    #1  
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
    #2  
Old 10-19-2010
Chubler_XL's Avatar
Chubler_XL Chubler_XL is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 22 April 2014, 11:13 AM EDT
Posts: 2,603
Thanks: 94
Thanked 804 Times in 757 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:


Code:
[autorun]
open=ksh -c myscript
action=Invoke MyScript in ksh shell
icon=myscript.ico
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 08:15 AM
Script to auto restart a service ajazshariff HP-UX 2 02-19-2010 02:26 AM
auto login script mohankasi Windows & DOS: Issues & Discussions 1 02-03-2009 05:23 AM
Auto answer ( Yes or No) from unix script Nayanajith Shell Programming and Scripting 3 08-22-2006 01:29 AM
Auto Alias Script coolboarderguy Shell Programming and Scripting 3 12-25-2005 08:11 AM



All times are GMT -4. The time now is 07:27 AM.