Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: changing dos path using batch file  (Read 4631 times)

0 Members and 1 Guest are viewing this topic.

sudesh_roy

    Topic Starter


    Newbie

    changing dos path using batch file
    « on: September 28, 2008, 09:07:43 AM »
    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.

    Carbon Dudeoxide

    • Global Moderator

    • Mastermind
    • Thanked: 169
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Experience: Guru
    • OS: Mac OS
    Re: changing dos path using batch file
    « Reply #1 on: September 28, 2008, 09:12:51 AM »
    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.

    TheShadow



      Hopeful

    • Retiree in Florida
    • Thanked: 13
      • Yes
      • The Doctor
    • Certifications: List
    • Computer: Specs
    • Experience: Guru
    • OS: Windows XP
    Re: changing dos path using batch file
    « Reply #2 on: September 28, 2008, 09:16:47 AM »
    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  8)


    Experience is truly the best teacher.
    Backup! Backup! Backup!  Ghost Rocks!

    sudesh_roy

      Topic Starter


      Newbie

      Re: changing dos path using batch file
      « Reply #3 on: September 28, 2008, 10:31:05 AM »
      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....

      Dias de verano

      • Guest
      Re: changing dos path using batch file
      « Reply #4 on: September 28, 2008, 11:10:03 AM »
      This sounds like school work to me.

      roohi



        Beginner

        Re: changing dos path using batch file
        « Reply #5 on: September 28, 2008, 11:19:11 PM »
        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