1.

Solve : changing dos path using batch file?

Answer»

I am new to batch programming.
I want to open a new dos window and set its path to c:/pqr/xyz at its opening, using batch file. Please help.In the beginning of the batch file, you must have the following:

cd "C:\pqr\xyz"

That will make the Command Prompt Window look at that directory.WOW, that was a brain teaser!

In my experiment I tried to open the command (cmd) window from the C:\temp FOLDER.

My LITTLE batch file looked like this:

cd\temp
cmd


That changed the current directory to my temp folder and then executed the CMD command.

When the resulting CMD windows opened, it was already in the C:\temp folder.

Well, it worked for me ANYWAY.

CHEERS Mate, and Good Luck,
The Shadow


Actually, I run my batch file currently from c:\sk\rnd directory which opens a new dos window with same path i.e. c:\sk\rnd whereas I want the new window with path as c:\pqr\xyz.
Also, if i want to open d:\abc\def from the same batch file how will i go....This sounds like school WORK to me.
Quote from: sudesh_roy on September 28, 2008, 10:31:05 AM

I want the new window with path as c:\pqr\xyz.
Also, if i want to open d:\abc\def from the same batch file how will i go....

you can try following code
Code: [Select]cd c:\pqr\xyz
call cmd
and for d:\abc\def
you can try following code
Code: [Select]d:
cd abc\def
call cmd
may code solve ur problem


Discussion

No Comment Found