Saturday 4 June 2011

How do I open a command prompt to a specific directory without changing the defaults?

I need the syntax to open a cmd window to a specifc diretory. I have tried clicking on Run: then entering the following





cmd /k c:\Documents and Settings





This does not work





I need to know how to do this from the Run line becasue I really need the syntax to be used in a Java program I am writing..Alternative methods of opening a cmd promt wont do me any good Thanks for any help|||cd c:\documents and settings





may try also





cd %26quot;C:\documents and settings%26quot;|||You need the CD command before the path, and quotes around it if there are spaces.





so it becomes this:





cmd /k %26quot;cd c:\Documents and Settings%26quot;





Although if it is on another drive you have to change drives after it has started, I%26#039;m not sure how to do it directly.





--------------------





Alternatively, you can have your Java program write a batch script like this:





CD (directory) - changes path


C: - changes drives


(other dos commands here)





And call cmd /k (generated batch file)