Jump to content

SUBST opening an explorer window


Recommended Posts

Hello!

I'm using AutoIt to automate the first steps of startup for an application i wrote in Paradox; during this process i use RunWait to execute SUBST to shorten the path to my app.

All works well, there's only one catch: while on Win2k or WinXP the SUBST command is completely silent, on win95/98/me it creates the fake drive, but also opens an explorer window on the drive.

Anybody knows how to prevent this?

Many thanks!

Link to comment
Share on other sites

Can't test it myself. But I'm thinking of a workaround... you know the file you find in the root of a CD? AUTORUN.INF

Place a file in the root of the directory you're SUBST'ing, named AUTORUN.INF

Put this in the contents:

[autorun]
OPEN=some.exe

Then you just need to have an .exe named some.exe (or whatever you name it), that does nothing. Now when the drive is SUBST'ed, the computer will check this autorun, and try to attempt to run the file.

Like I said, not tested, just a theory. I don't have a non-WinXP computer to try it on.

Good luck.

Edit: In case it does work, a good .exe could just be some compiled AutoIt code with #NoTrayIcon (that way when it runs you won't even have an icon flash in the tray momentarily).

Edited by Saunders
Link to comment
Share on other sites

All works well, there's only one catch: while on Win2k or WinXP the SUBST command is completely silent, on win95/98/me it creates the fake drive, but also opens an explorer window on the drive.

Anybody knows how to prevent this?

I cannot replicate this problem on Windows 98 or Me--but I'm testing with fresh installs on Virtual PC without any Windows Updates....

Run(@ComSpec & " /c subst Z: C:\Windows", "", @SW_HIDE) ;example

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

All works well, there's only one catch: while on Win2k or WinXP the SUBST command is completely silent, on win95/98/me it creates the fake drive, but also opens an explorer window on the drive.

Anybody knows how to prevent this?

Many thanks!

You could try this, in case the window opens:

Opt('WinTitleMatchMode', 2)
$drive = 'Z:'
$folder = 'C:\Windows'
$title = 'Windows'
Run(@ComSpec & ' /c subst ' & $drive & ' "' & $folder & '"', '', @SW_HIDE)
WinWait($title, '', 3)
If WinExists($title) Then WinClose($title)
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
 Share

  • Recently Browsing   0 members

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