PC Review


Reply
Thread Tools Rate Thread

AutoRun working too well

 
 
David Winfrey
Guest
Posts: n/a
 
      27th Jul 2006
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?
 
Reply With Quote
 
 
 
 
Mark V
Guest
Posts: n/a
 
      27th Jul 2006
In microsoft.public.win2000.cmdprompt.admin David Winfrey wrote:

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

 
Reply With Quote
 
David Winfrey
Guest
Posts: n/a
 
      28th Jul 2006
Mark V <(E-Mail Removed)> wrote:
:
: 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Autorun Not working apl Windows XP General 2 24th Nov 2007 07:10 AM
Autorun not working Teriel9 Windows XP General 6 8th Dec 2005 11:08 AM
AutoRun not working with CD or DVD Rob Windows XP Hardware 2 9th Jan 2005 08:56 PM
Autorun.inf not working Chris Lee Windows XP General 0 28th Oct 2004 07:49 AM
Re: Autorun not working Kelly Windows XP General 4 6th Sep 2003 05:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:51 AM.