Jump to content

[VBS/Autorun] - Autorun message box


Recommended Posts

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.vbs

And 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?

Link to comment
Share on other sites


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.exe

icon=setup.exe,0

Have 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 If
then the SFX file could be named EG : Usb.exe

[Autorun]open=Usb.exe

I 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 by gunsmokingman
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.ico

My inf InfWorkedOnCD.PNG

Edited by gunsmokingman
Link to comment
Share on other sites

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 by cluberti
Link to comment
Share on other sites

and there are some security concerns there
Most definitely. Remember the Sony CDs that would silently install a rootkit on your computer via AutoRun if it was enabled?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...