I am trying to create two bat files. one is c.bat and the other is r.bat
c.bat just contains:
cls
javac *.java
which will compile all .java files.
in r.bat I have:
cls
java *
it will not run the class files. I think its because the * in the “java *” line translates to “java Class1.class”, “java Class2.class” and so one when it should be “java Class1” and “java Class2” only. (without the extensions) how can I do this? I just started learning these things and I can’t find the right answer anywhere.
The following loops over all the
.javafiles found inC:\java\stuffand runs them one after another. The%%~nfis formatting the files name to not display the file extension i.e the java class name. If you changejava %%~nftoecho java %%~nfyou can see exactly what is going on.For: The following options are available: