Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and Unix shell scripting Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Auto run script on USB device

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 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 Unix and Linux 10-19-2010
Chubler_XL's Unix or Linux Image
Chubler_XL Chubler_XL is offline Forum Staff  
Join Date: Oct 2010
Last Activity: 20 October 2016, 10:32 PM EDT
Posts: 3,300
Thanks: 131
Thanked 1,114 Times in 1,037 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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 Alias Script coolboarderguy Shell Programming and Scripting 3 12-25-2005 08:11 AM

All times are GMT -4. The time now is 10:06 AM.