Usando código de lote para formatar xml em massa?

Eu tenho uma pasta que contém 50 subpastas, cada uma delas contém 2 arquivos xml

O_DATA.xml
S_DATA.xml

Como eles aparecem em uma linha no bloco de notas, tenho que corrigir a formatação.

Eu encontrei a partir de uma pergunta semelhante aqui este código:

@echo off
setlocal EnableDelayedExpansion

rem Create a variable with spaces
set "spaces= "
for /L %%i in (1,1,5) do set "spaces=!spaces!!spaces!"

rem Read the line
for /F "delims=" %%a in (input.txt) do set "line=%%a"

set level=0
:nextTag
   rem Separate first tag from line
   for /F "tokens=1* delims=<" %%a in ("!line!") do (
      set "tag=%%a"
      set "line=%%b"
   )
   rem Show first tag in one separate line
   if "%tag:~0,1%" equ "/" set /A level-=5
   echo !spaces:~0,%level%!^<!tag!
   if "%tag:~0,1%" neq "/" set /A level+=5
if defined line goto nextTag

Script de lote para formatar arquivos XML | Procure por Strings e comente-as

Mas não é realmente a mesma coisa e também estive estudando essa resposta, mas não sei muito sobre código de lote.

Portanto, a questão é como criar um script em lote que será executado na estrutura da pasta e formatá-los?

Atualizar: Eu tentei isso:

C:\Users\user>for /d %%X in (C:\<C:\Users\user\Desktop\qq>\*)
do (c:\<C:\Users\user\Downloads\tidy-5.6.0-vc14-32b\tidy-5.6.0-vc14-
32b\bin>\tidy.exe -m -xml -config c:\<C:\Users\user\Downloads\tidy-5.6.0-
vc14-32b\tidy-5.6.0-vc14-32b\bin>\tidycfg.ini %%X\<O_DATA>.xml)

gives: %%X was unexpected at this time.

e se eu excluir um% dá:

< was unexpected at this time.

aini o arquivo possui:

indent:yes
indent-attributes:yes

questionAnswers(2)

yourAnswerToTheQuestion