Jump to content

DOS Window Question


Donkeykong23

Recommended Posts

I have my folder containing my java files and it's not easy to locate with the cmd, so I made a batch file to set my location for me.

 

The problem is that the window will close after I run the batch file which contains "cd path\to\my\java\folder" and if I add pause to it, it just says "Press any key to continue..."

 

I don't want it to close.. I want to be able to work off of that so I don't have to type cd blah blah every time I open the cmd.

Link to comment
Share on other sites

You might be interested to know that if you're using Windows Vista/7, you can hold down shift while right-clicking any folder, and a new option will appear - "Open Command Window Here". Very useful. ;)

 

I have a batch file I use to make my c++ compiler work. All I do is type the name of the file and it executes the command.. Whats yours look like? Maybe there's an extra command or something that shouldn't be there?

 

 

His problem is that he's written a batch file that has

cd c:\whatever

 

In it, and when you double click a batch file it closes as soon as execution is complete, so it changes directory, then immediately closes.

 

Using the shortcut I mentioned above will help, alternatively, change the batch file to something like:

cd c:\your\java\dir
cmd /k calc[Caution: Executable File]

 

Then just close the calculator window that appears.

Link to comment
Share on other sites

Thanks Mage!

 

I actually found out that just doing cmd /k cmd[Caution: Executable File] works, and starts in the folder that the .bat is executed in.

 

So a bat containing cmd /k cmd.ex e works fine. :)

 

On Vista btw, not 7(yet).

 

You can also do:

cmd /k pushd "c:\your\directory"

 

As a shortcut.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.