i am trying to write a batch program to find the first file of a given type, lets say a .txt for example, to afterwards pass it to a java program which uses the file name and path to run.
I can already find and check if a file of the type exists but i think i am getting something wrong with the set command and how to handle the parameter afterwards.
if exist *.txt (
echo txt exists
set file = exist *.png
) else (
echo No txt file found
exit
)
echo Using %file%
java -jar MyJavaProgram.jar -%file%
I would like to do it without any arguemnts i have to pass in on the command line level and i also can not change the java jar to handle this problem.