1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

AutoRun.inf?

Discussion in 'Support' started by vefatica, Jan 22, 2009.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,794
    Likes Received:
    29
    In another thread someone asked about running a batfile when an IPOD was plugged in. Another person suggested an AUTORUN.INF in the IPOD's root directory. This made me wonder if I could get an external storage device to mount on a drive letter of my choosing. I've almost got it (all but the AUTORUN.INF part).

    Supposing the AUTORUN.INF mechanism works, I'd use it to run ASSIGN.BTM which resides on the removable media:

    SET current=%@left[1,%@full[%0]]
    ECHO Current drive letter: %current
    INPUT New drive letter:` ` %%new
    ECHO New drive letter: %new
    ECHO select volume %current > v:\diskpart.scr
    ECHO assign letter=%new >> v:\diskpart.scr
    CDD v:\
    v:\assign.btm

    In order for the change of letter to take place without a reboot message the removable media must not be busy. Thus ASSIGN.BTM leaves (with CDD) if necessary, and the current BTM exits when V:\ASSIGN.BTM is invoked.

    V:\ASSIGN.BTM says, simply

    diskpart.exe /s v:\diskpart.scr
    CDD %new:\

    All that works. Maybe the AUTORUN.INF part is easy (maybe impossible); I haven't tried yet.
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    I assume your system contains your utilities on a drive to which the drive letter V is permanently assigned.

    Regardless, the above scheme seems to be very useful as well for "inikey" usage of TCMD/TCC "on a stick".

    BTW, your message did NOT arrive in my email...
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,794
    Likes Received:
    29
    On Fri, 23 Jan 2009 07:03:18 -0600, Steve Fábián <> wrote:


    Hmmm! I can't get the autorun mechanism to work (and searching only turned up
    folks who couldn't **keep** it from working. According to MS, this should work:

    [AutoRun]
    shellexecute="assign.btm"

    Assign.btm becomes what happens when I double-click the external drive and it
    appears on the context menu, but nothing happens when I plug in the drive and
    Windows discovers it. It's a WD Passport. Any thoughts?
     
  4. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,179
    Likes Received:
    11
    Try using open instead of shellexecute.

    [autorun]
    open=v:\tcmd9\tcc.exe /c v:\assign.btm

    -Scott

    vefatica <> wrote on 01/23/2009 08:30:48 AM:


    onlyturned up

    and it

    drive and

     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,794
    Likes Received:
    29
    On Fri, 23 Jan 2009 10:00:20 -0600, samintz <> wrote:


    That was the first thing I tried (in vain). MS says shellexecute works just
    like open but lets you use associations.
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,280
    Likes Received:
    38
    But on most systems, .BTM won't be associated with anything....
     
  7. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,280
    Likes Received:
    38
    FWIW, my 4NT-on-a-stick setup used ShellExecute= instead of Open=, but it just pointed to the executable:

    Code:
     
    [autorun]
    UseAutoPlay=1
    ShellExecute=usbbin\4nt\4nt.exe
    Icon=usbbin\4nt\4nt.exe
    Label=Portable 4NT
    
    
    </PRE>
     
  8. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,794
    Likes Received:
    29
    On Fri, 23 Jan 2009 10:55:41 -0600, Charles Dye <> wrote:


    BTM has an association here. And part of it works. I get "AutoRun" on the
    context menu and if I 2-click the removable drive in Explorer, I get the desired
    autorun behavior. It's just not "auto".
     
  9. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,179
    Likes Received:
    11
    I know that the icon entry works. Have you tried to launch an executable
    just to see if it works?

    -Scott

    vefatica <> wrote on 01/23/2009 11:33:11 AM:


    just

     
  10. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,179
    Likes Received:
    11
    I just re-read your message. If you double-click on the drive icon in My Computer it executes assign.btm but it does not autorun when first plugged in? Is that what you are saying?

    There is a very good article and explanation on Wikipedia of AutoRun and AutoPlay. It's possible you have a policy setting in your registry that's blocking AutoPlay from running your file.

    http://en.wikipedia.org/wiki/Autorun

    -Scott


     
  11. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    Charles Dye wrote:
    | FWIW, my 4NT-on-a-stick setup used ShellExecute= instead of Open=,
    | but it just pointed to the executable:
    |
    |
    | Code:
    | ---------
    |
    | [autorun]
    | UseAutoPlay=1
    | ShellExecute=usbbin\4nt\4nt.exe
    | Icon=usbbin\4nt\4nt.exe
    | Label=Portable 4NT

    Am I correct assuming that usbbin is a top-level directory on the stick? Is
    it possible to specify additional parameters for 4nt (e.g., location of .ini
    and 4start) on the ShellExecute= line?
    --
    Steve
     
  12. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,794
    Likes Received:
    29
    On Fri, 23 Jan 2009 11:33:45 -0600, samintz <> wrote:


    I've seen several such articles. It's a brand new machine and I have not
    monkeyed with any such settings.

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun
    has the default value 0x91 which, as I understand it forbids autorun for
    DRIVE_REMOTE (network) and DRIVE_UNKNOWN. TCC identifies the external HD as
    DRIVE_FIXED.
     
  13. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,280
    Likes Received:
    38
    Yes, USBBIN is a (the) top-level directory. And yes, you can specify additional parameters. Locations, however, are not a good use. At the time you create AUTORUN.INF, you have no way of knowing how the drive will be mapped -- what drive letter it will be assigned, or even whether it will get a drive letter. Instead of hard-coding paths in AUTORUN.INF, you need to get them dynamically in 4START with e.g. %@PATH[%_CMDSPEC] and save in environment variables or directory aliases or whatever.
     
  14. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,179
    Likes Received:
    11
    Another registry key to look at is
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers

    There's a bunch of stuff in there including cancelling of AutoPlay based
    on the file that it's supposed to run.

    -Scott

    vefatica <> wrote on 01/23/2009 01:05:14 PM:


    not

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun

    HD as

     
  15. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    Charles Dye wrote:
    | ---Quote (Originally by Steve Fábián)---
    | Am I correct assuming that usbbin is a top-level directory on the
    | stick? Is
    | it possible to specify additional parameters for 4nt (e.g., location
    | of .ini
    | and 4start) on the ShellExecute= line?
    | ---End Quote---
    | Yes, USBBIN is a (the) top-level directory. And yes, you can specify
    | additional parameters. Locations, however, are not a good use. At
    | the time you create AUTORUN.INF, you have no way of knowing how the
    | drive will be mapped -- what drive letter it will be assigned, or
    | even whether it will get a drive letter. Instead of hard-coding
    | paths in AUTORUN.INF, you need to get them dynamically in 4START with
    | e.g. %@PATH[%_CMDSPEC] and save in environment variables or directory
    | aliases or whatever.

    That's basically what I have been doing for many years and many machines
    with varying directory hierarchies. The only difficulty is specifying the
    location of TCSTART / 4START (they are normally not in TCC's own directory),
    but that's not critical - your method can redirect to the "real" one.

    BTW, I just tested TCC9 B154, and it accepts paths relative to its own
    location in .INI directives INCLUDE, TCStartPath, etc., which makes such
    things much simpler.
    --
    Steve
     

Share This Page