I am having a struggle with loop using "for" and to set the variable for later action.
So briefly explaining about a situation I am facing, I have files named "HI_001_1813414.nii.gz" & "HI_001_1813414_T1.nii.gz" , and I want to set each two files' name as a variable, so that I can use it for later action.
Here is my batch script.
path=C:\Users\user\Desktop\dsi_studio_64
for /f "delims=" %%x in ('dir *_T1.nii.gz /b /d') do (
set fname=%%x
set name=%fname: ~-7%
set dwi_fname = %fname:_T1 =%
call dsi_studio.exe --action=reg --from=%%x --to=%dwi_fname% --output=%%x_norm.nii.gz --reg_type=0 > "%%x.log.txt"
)
The main problem here is: the variable I set shows only the last one (I checked it with echo).