USB autorun in W7

Page 1 of 2 12 LastLast

  1. Posts : 26
    xp/Windows 7
       #1

    USB autorun in W7


    Ok, I know this is a sore subject, but are there any work-a-rounds to get handy programs like PortableApps to at least be an option to run when you plug it in? It kind of defeats the purpose of the whole thing. I'm not plugging in rogue USB sticks from strangers in dark alleys, just my own USB hard drives. It get really annoying when you have to drill into your own drive 20 times a day just to double click the exe to run the dang thing you know is safe.

    Someone in another thread posed Autorunner.exe, but it doesn't seem to do anything at all...

    http://johnhaller.com/jh/useful_stuf...ws_7_autoplay/
    -b
      My Computer


  2. Posts : 2,111
    Win7 Build 7600 x86
       #2

    Benway said:
    Ok, I know this is a sore subject, but are there any work-a-rounds to get handy programs like PortableApps to at least be an option to run when you plug it in? It kind of defeats the purpose of the whole thing. I'm not plugging in rogue USB sticks from strangers in dark alleys, just my own USB hard drives. It get really annoying when you have to drill into your own drive 20 times a day just to double click the exe to run the dang thing you know is safe.

    Someone in another thread posed Autorunner.exe, but it doesn't seem to do anything at all...

    -b
    wouldn't a autorun.inf do the trick?

    You can search for options and syntax of autorun.inf in google.

    Just an example of an autorun.inf:

    [autorun]
    OPEN=custom_setup.CMD
    ICON=SETUP.EXE,0

    shell\configure=&Configure...
    shell\configure\command=SETUP.EXE

    Good luck
      My Computer


  3. Posts : 26
    xp/Windows 7
    Thread Starter
       #3

    squonksc said:
    wouldn't a autorun.inf do the trick?

    You can search for options and syntax of autorun.inf in google.

    Just an example of an autorun.inf:

    [autorun]
    OPEN=custom_setup.CMD
    ICON=SETUP.EXE,0

    shell\configure=&Configure...
    shell\configure\command=SETUP.EXE

    Good luck
    W7 ignores autorun.inf now. The most it will do is open up the drive so you can go find the file and run it manually. Seems like a step backwards in technology to me. "if you can't fix it, disable it" appears to be the rule of the day.
      My Computer


  4. Posts : 5
    Windows 7
       #4

    autorun.info was disabled to prevent abuse and viruses, like the USB switchblade from being used(Open files on folder - install malware).

    That update is also being pushed to Vista and XP soon. The obvious issue was that social engineering made it possible to spread malware fairly quickly.

    On topic, just create a shortcut to StartPortableApps.exe and don't try to open it if the drive isn't in.

    (You can always manually open the root of the drive and start it).
      My Computer


  5. Posts : 2
    Windows 7
       #5

    Hi.

    It maybe be a little on the technical side, but I have posted an alternative solution using a powershell script here and/or here.

    Of course it's a 'per-computer' solution, in fact it writes nothing on your usb key/drive.
      My Computer


  6. Posts : 2
    Win 7 Ultimate
       #6

    :(


    none of the above worked for me

    is it possible to create a hotkey like shift + r to run a file?
    i know its not perfect but it might work?
      My Computer


  7. Posts : 6,285
    Windows 10 Pro X64
       #7

    none of the above worked for me

    Did you try creating shortcuts to the PAs on the USB drive? What didn't work?
      My Computer


  8. Posts : 2
    Win 7 Ultimate
       #8

    i dont try shortcuts, and the script written by monotone works:)
    but it only works once, when you unplug it and plug it back in it doesnt work again
    is there a way of refreshing it?
      My Computer


  9. Posts : 2,737
    Windows 7 Enterprise (x64); Windows Server 2008 R2 (x64)
       #9

    I updated the script to use any drive letter and any volume name and use StartUp.cmd on your flash drive. Put anything you want in StartUp.cmd copy it to the root of the flash drive:

    #Requires -version 2.0
    #Modified 01-18-2010: Use Any Driver Letter & Volume Name: by J. Hill
    Register-WmiEvent -Class win32_VolumeChangeEvent -SourceIdentifier volumeChange
    write-host (get-date -format s) " Beginning script..."
    do{
    $newEvent = Wait-Event -SourceIdentifier volumeChange
    $eventType = $newEvent.SourceEventArgs.NewEvent.EventType
    $eventTypeName = switch($eventType)
    {
    1 {"Configuration Changed"}
    2 {"Device Arrival"}
    3 {"Device Removal"}
    4 {"Docking"}
    }
    write-host (get-date -format s) " Event detected = " $eventTypeName
    if ($eventType -eq 2)
    {
    $driveLetter = $newEvent.SourceEventArgs.NewEvent.DriveName
    $driveLabel = ([wmi]"Win32_LogicalDisk='$driveLetter'").VolumeName
    $driveType = ([wmi]"Win32_LogicalDisk='$driveLetter'").DriveType
    write-host (get-date -format s) " Drive name = " $driveLetter
    write-host (get-date -format s) " Drive label = " $driveLabel
    # Execute process if drive matches specified condition(s)
    # if ($driveLetter -eq 'Z:' -and $driveLabel -eq 'Mirror')
    if ($driveType -eq 2)
    {
    write-host (get-date -format s) " Starting task in 3 seconds..."
    start-sleep -seconds 3
    start-process $driveLetter"\StartUp.cmd"
    }
    }
    Remove-Event -SourceIdentifier volumeChange
    } while (1-eq1) #Loop until next event
    Unregister-Event -SourceIdentifier volumeChange
    Last edited by WindowsStar; 21 Jan 2010 at 02:00.
      My Computer


  10. Posts : 2
    Windows 7
       #10

    fletcher: the script is supposed to loop indefinitely without further intervention. If it stopped after one use, maybe there was an error or something. I suggest trying to run it directly from the Powershell ISE interface, or remove the "hidden" option, and check if you see any errors. When running, you should see "Event detected ...." on the screen whenever you plug or unplug something.
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:38.
Find Us