'Relative paths in windows batch file
This seems to be the directory where my batch file my-build resides.
Program\
my_app\
javasdk\
java-build.bat
app\
my-build.bat
I want to run from my batch file
1. Move one level up and run java-build.bat
2. And then run one more command in app dir
I tried
cd ..
javasdk\java-build
cd..
app\my-build
app- antbuild.bat -D env.myAppjars= C:\Source\abcd\my-app\app\lib
I am getting some errors.
Am I doing it correct? How can I use relative path instead
C:\Source\abcd\my-app\app\lib
Solution 1:[1]
You are in C:\Source\abcd\my-app\javasdk and want a relative path to C:\Source\abcd\my-app\app?
Go one up and then down the other path:
cd /d "C:\Source\abcd\my-app\javasdk"
echo you are in %cd%
dir "..\app"
To go "two up" use ..\.. and so on.
Also use call to call another batchfile. If you just execute it with it's Name, there is no return to the calling file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Stephan |
