Since noone has provided any answer will provide my solution, which uses delayed variable expansion for variables used inside for loop.
@echo off
setlocal EnableDelayedExpansion
cd e:\WORK\NetBeansProjects\potyczki
pwd
set testdir=D:\___Potyczki_Algorytmiczne\2024\mro_tests
for %%f in (%testdir%\*.in) do (
set inname=%%f
call set outname=%%inname:in=out%%
call java -classpath target/classes/ pl.kazanik.potyczki._2024.Mrowki !outname! < !inname!
)