Search code examples
javacmdjavacfilepathshortcut

How can i build to a folder that lives one directory down from my current folder


I want to compile to a file that lives in folder src. The build folder lives in the same folder as my src folder.

So in CMD i am currently in C:\Programming Projects\Java Sample Projects\src> I want to build to C:\Programming Projects\Java Sample Projects\build>

I know i can use the "-d" option to specify the path but is there a quick way to say "{1 folder up}\build"?

I would like to do this so i dont have to write out the whole path every time

Thank you


Solution

  • If you have a file in C:\Programming Projects\Java Sample Projects\src and you want to reference C:\Programming Projects\Java Sample Projects\build , you can use ..\build. Double-period (..) will go up one directory. In fact:

    C:\Programming Projects\Java Sample Projects\src\..\build = C:\Programming Projects\Java Sample Projects\build

    Try that in windows explorer