Zxian Posted April 30, 2006 Posted April 30, 2006 I just picked up a new USB key, and I'd like to put a simple VBS script on it to display the owner info when it is plugged into a USB port.Here is the content of my autorun.inf file:[Autorun]open=info.vbsAnd the contents of info.vbs:Msgbox "This USB key is the property of Nicholas Geraedts." & vbCrLf & vbCrLf & "If you have found it, please call XXX-XXX-XXXX."For some reason, the standard autorun window appears (asking me what I want to do). Is there something that I'm missing in order to make this work? Or is it simply not possible with removeable drives?
gunsmokingman Posted May 1, 2006 Posted May 1, 2006 (edited) I do not know much about the inf stuff but on xp it looks like this,also I am not sure if a VBS file can run from a INF file.[AutoRun]open=setup.exeicon=setup.exe,0Have you tried putting the VBS file inside of a SFX, then it would have a exe to start instead of a VBS.I modified your script to this, just have the SFX file extract to Systemdrive, it runs and deletes the file.Save as UserUsb.Vbs,Dim Act : Set Act = CreateObject("Wscript.shell")Dim Loc : Loc = Act.ExpandEnvironmentStrings("%SystemDrive%\UserUsb.Vbs")Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")Msgbox "This USB key is the property of Nicholas Geraedts." & vbCrLf &_vbCrLf & "If you have found it, please call XXX-XXX-XXXX.", 0 + 48, "Is This Your USB Key?"If Fso.FileExists(Loc) Then Fso.DeleteFile(Loc) End Ifthen the SFX file could be named EG : Usb.exe[Autorun]open=Usb.exeI made the script in to a SFX file for you to test.I Gunsmokingman give all users full permission to do what ever they want with this script.Usb.exe Edited January 25, 2014 by gunsmokingman
Zxian Posted May 1, 2006 Author Posted May 1, 2006 That didn't seem to work. I'm wondering if it's a security feature to not allow this type of occurance. I've got the icon entry in there as well, with a custom icon, but I think that's just for what shows up in My Computer when the drive is loaded.
gunsmokingman Posted May 1, 2006 Posted May 1, 2006 (edited) That could be it as I said I have very little knowledge in inf stuff and auto run stuff.I tested this on a regular CD and it did work on that, I even added a icon to it.[Autorun]open=Usb.exe Icon=Hta2.icoMy inf Edited May 1, 2006 by gunsmokingman
cluberti Posted May 4, 2006 Posted May 4, 2006 (edited) Note that, in XP, removable drives do not support autorun at all. AutoPLAY works (that little menu you always see, asking you what to do), but autoRUN will not work - it's actually coded not to work, for a few different reasons (one being it's being emulated similar to a SCSI bus, and there are some security concerns there, etc). I'm not the developer, so I don't know all of the reasons why, but I do know for sure that this won't work from a removable device like that. Edited May 4, 2006 by cluberti
Zxian Posted May 4, 2006 Author Posted May 4, 2006 Ah... that would explain why. Thanks for the info, even if it was disappointing.
LLXX Posted May 4, 2006 Posted May 4, 2006 and there are some security concerns thereMost definitely. Remember the Sony CDs that would silently install a rootkit on your computer via AutoRun if it was enabled?
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now