September 9, 201015 yr 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.
September 9, 201015 yr 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?
September 9, 201015 yr 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 hascd 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.
September 9, 201015 yr Author Thanks Mage! I actually found out that just doing cmd /k cmd. exe works, and starts in the folder that the .bat is executed in. So a bat containing cmd /k cmd. exe works fine. :) On Vista btw, not 7(yet).
September 9, 201015 yr 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.
Create an account or sign in to comment