change directories(newbie)

Steve Holden sholden at
Tue Nov 7 21:42:43 CET 2000

(posted & mailed)

Brendhan Horne wrote:
> OK I got this one I think.
> When in DOS if I do a cd\ Python20 it will change the prompt to C:\python20

Accepting that your spacing is wrong, yes, that's how the cd command works.

> However it seems that it is still in a DOS based setup.  If  I am at
> c:\Python20>
> I have to enter python.exe to get the python command prompt. I set a path in
> DOS where a DIR/s python.exe will now find the file but unless I click on
> the python command line icon in windows changing directories to a python
> prompt ie >>> has to be done by typing in c:\windows>cd\python20\python.exe.

If I understand you, you are complaining that DOS doesn't know how to find
the Python executable so you can just type the command


to see the >>> prompt (which means you are running the Python interpreter).

>  How do I get it from C;\windows> to  >>> in the shortest command possible
> in a windows DOS setting.? Should I move or copy python,.exe straight to C:\
> or is their another way?

There is another way!  DOS maintains a special environment variable called
PATH, which is a list of directories (separated by semicolons) to search for

Here's a file called "py.bat" which I have dropped into my C:\WINDOWS
directory, which adds the right directory to PATH and then puts me in to
the directory I normally use for Python development:

	echo off
	cd \steve\projects\python
	path "D:\Python20;%path%"
	echo Pythonized

> Please forgive the vague standing of my previous question but I was trying
> to figure the path ways to from this ">>>" to this "c:\" and the reverse in
> a nice quick easy manner. I think I have a partial answer but a little
> knowledge that is just dangerous enough to cause me to have to a:\format c:.

Not at all.  When you get more experience you will find there are other ways
to set PATH so that it's correct when you open a DOS window under Win98.  For
now, though, try creating C:\WINDOWS\PY.BAT, then just enter the commands


when you want to run the Python interpreter.

> --
> Thanks,
> Brendhan
> Brendhan Horne <brendhanhorne at> wrote in message
> news:B6VN5.3593$B14.42568 at news4.mia...
> > Using Python 2.0 in a DOS promt
> > c:\python>
> > How do I change the directory back to a c:\ or a c:\windows>
> >
> > --
> > Thanks,
> > Brendhan
> > PS. Using Win98se
> >
> >

Also, thanks for thinking hard enough to realise that your original post
didn't really explain the problem.  Good luck with Python!

the-more-you-give-the-more-you-get-ly y'rs - steve
Helping people meet their information needs with training and technology.
703 967 0887      sholden at

More information about the Python-list mailing list