I heard that java code cannot be to add into batch file in a comment on my previous question:
But is there any alternatives to it? Is it possible to add java cod
Make your Java program pass the filename to the batch file as a command-line option. Within the batch file, you can access the it as the variable %1. You can pass multiple command-line options; the others will be available as %2, %3, and so on.
%1
%2
%3