Windows95: initializing Python env on start-up

Jonadab the Unsightly One jonadab at
Tue Sep 5 03:55:46 CEST 2000

Michael Dyck <MichaelDyck at> wrote:

>     To get a permanent setup, you can call the setup file from
>     autoexec.bat (Windows 95/98), ...
> Unfortunately, they don't give the exact syntax for doing this. 

That's what your DOS manual is for.  

What, Windows doesn't come with a manual?  Oh.  Yeah.  Almost
forgot.  If you can get your hands on an old DOS manual, it's
worth reading.  Lots of good info in there.  Otherwise, your
Windows CD may have, hidden somewhere, a directory called
OLDDOS, which may include a file HELP.COM, which you should
run to read the online docs that came with DOS 6.  Not as 
good as a manual, but WAY better than those silly HLP files.

> After some
> experimentation in an "MS-DOS Prompt" window, I found that the command
>     call C:\Downloaded\py152\setup.bat
> had the desired effect, 

Yes, that's the thing.  CALL is one of those special commands
included just for batch files.  DO is another handy one you
should know.  And IF is rather handy.  Also CHOICE.  Come
to think of it, read the whole section on "special commands
for BAT files", either in a DOS manual or the aforementioned

> so I added the same line to my C:\AUTOEXEC.BAT
> file and restarted Windows. But Windows seems to completely ignore the
> line. Specifically, when I start an "MS-DOS Prompt" window, the variables
> PYROOT, PYTHONPATH, etc have not been defined, and PATH has not been
> modified to include PYROOT.  However, the commands in autoexec.bat before
> and after the "call" command *have* been executed.
> And yes, I've checked numerous times that the command in the autoexec.bat
> file is the same as the one that works at the MS-DOS prompt.


Hmmm... Odd, it works for me (on '95 OSR2)...  I'll paste a
transcript in below.  Try putting something in the called 
batch script that you will be able to positively identify 
whether it has been called.  For example, insert the following
(harmless) line into C:\Downloaded\py152\setup.bat

echo | time > C:\tempfile.txt

Then reboot, and open that file up and see whether it shows
the time you booted.  If it does, then the batch file was
called correctly.  (Whether changes to the environment
persist then becomes the next question; they *should*, I
think, but...)

> So: is there a different syntax I need to use in order to execute
> py152\setup.bat from autoexec.bat?

At worst you could copy lines from that file to AUTOEXEC.BAT, but
that's ugly.

> And if there *were* something wrong with a command in autoexec.bat, would
> error messages get written somewhere?

To the console, during bootup.  

Another thought...  how many environment variables do you have set?
Could your environment be FULL?  That *can* happen...  type SET
at a command prompt and tell us how many lines the response takes up.

[Transcript demonstrating CALL follows...]


 Volume in drive D is DATA
 Volume Serial Number is 0C2D-16EA
 Directory of D:\temp\temp

.              <DIR>        08-31-99  3:32p .
..             <DIR>        08-31-99  3:32p ..
TEMP     BAT            39  09-04-00  9:39p TEMP.BAT
TEACHME  TXT     4,375,037  08-31-00 12:01p teachme.txt
PERSIST        <DIR>        08-31-99  3:32p persist
PB             <DIR>        05-17-00  8:48a pb
TEMPTWO  BAT            27  09-04-00  9:39p temptwo.bat
GEEK           <DIR>        05-30-00  7:28a geek
WSR            <DIR>        03-06-00 12:27p wsr
         3 file(s)      4,375,103 bytes
         6 dir(s)     182,173,696 bytes free

D:\temp\temp>type temp.bat

set TEMPVAL=blahblah;
CALL temptwo

D:\temp\temp>type temptwo.bat

set TEMPTWO=xyzzyplugh;

D:\temp\temp>call temp.bat

D:\temp\temp>set TEMPVAL=blahblah;

D:\temp\temp>CALL temptwo

D:\temp\temp>set TEMPTWO=xyzzyplugh;



BLASTER=A220 I7 D1 H1 REC0 T6 P100
CMDLINE=ued temp.bat


[Incidentally, I didn't realise my PATH was that messy; I'll have to
 do something about that...]

- jonadab

More information about the Python-list mailing list