Noob: How to redirect output in FitToCSV.bat?

When I add the -d option in the FitToCSV.bat file, the output appears in the cmd window.  Refer to https://developer.garmin.com/fit/fitcsvtool/commandline .

How do I redirect it to a file in the same folder as the input FIT file?

It's been 40+ years since I did any BAT programming (for DOS).  And it appears that Windows BAT programming is more advanced.  So I really don't know what I'm doing (sigh).

Without understanding much, I tried to mimic the existing paradigm based on the "c" variable (output CSV filename), to wit:

set a=%*
FOR %%b IN (!a!) DO (
   set c=%%b
   set c=!c:.fit=!
   set d=%%b
   set d=!d:.dbg=!
   call java -jar %APP_PATH% -b %%b !c! -d 2> !d!
)

The intent is to send the debug output to a filename of the form basename.dbg.

I tried both ">" (stdout) and "2>" (stderr).  I suppose I could try other file numbers (e.g. "3>", "4>" etc).

But the problem is:  with ">" and "2>", the bat file aborts with the error "access denied".

Yet I have no problem saving a Notepad file to foobar.dbg in the intended folder.