AutoRun working too well

D

David Winfrey

I wanted a batch file to run when I started the command shell,
so I added to HKEY_CURRENT_USER\Software\Microsoft\Command Processor
a new string, AutoRun="d:\usr\home\cmdsetup.bat".

It worked perfectly, until I ran a program that used spawn()
to call another program. In a loop. A long loop. And at
every iteration of that long loop, my cmdsetup.bat got
executed.

Is there some way (short of upgrading to Win98) to set up an AutoRun
that will execute only when the shell is started by clicking on the
desktop shell icon, and NOT when the shell is run from inside some
other program?
 
M

Mark V

In said:
I wanted a batch file to run when I started the command shell,
so I added to HKEY_CURRENT_USER\Software\Microsoft\Command
Processor a new string, AutoRun="d:\usr\home\cmdsetup.bat".

It worked perfectly, until I ran a program that used spawn()
to call another program. In a loop. A long loop. And at
every iteration of that long loop, my cmdsetup.bat got
executed.

Is there some way (short of upgrading to Win98) to set up an
AutoRun that will execute only when the shell is started by
clicking on the desktop shell icon, and NOT when the shell is
run from inside some other program?

Why not point that shortcut (in)directly to cmdsetup.bat instead?
Possibly with adjustments like CLS and no EXIT statement.
Sonething like
CMD.EXE /k d:\usr\home\cmdsetup.bat

But perhaps this all can be done otherwise, depending on what
cmdsetup.cmd actually does... ?
 
D

David Winfrey

:
: Why not point that shortcut (in)directly to cmdsetup.bat instead?
: Possibly with adjustments like CLS and no EXIT statement.
: Sonething like
: CMD.EXE /k d:\usr\home\cmdsetup.bat

Thanks, but the solution I finally resorted to was simpler;
I added a line to the batch file to test for the existence of
one of the variables that the batch file sets. If it finds
%USRPATH% in the environment, it knows it's running as a child
of itself, and exits immediately. Not a perfect solution, but
a working one. I should have figured it out sooner; that's a
standard way to prevent double inclusion of C header files.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[Update] Autoruns v8.3 1
[Update] Autoruns v8.22 2
[Update] Autoruns v8.31 3
ms-dos 4
ms-dos command 1
Restoring AutoRun to Drives 2
[Update] Autoruns v8.13 3
[Update] Autoruns v8.12 1

Top