I am trying to make a batch file for converting certain file types. So I don't put more useless loops in the code, I wanted to put it into one loop.
This is my code so far:
cd "%inputdir%"
setlocal disableDelayedExpansion
for /f "delims=" %%A in ('forfiles /s /m *.tga /c "cmd /c echo @relpath"') do (
set "file=%%~A"
setlocal enableDelayedExpansion
set filenametmp=%outputdir%!file:~1,-4!.paa
setlocal enableDelayedExpansion
For %%A in ("!filenametmp!") do (
Set foldertmp=%%~dpA
)
setlocal enableDelayedExpansion
IF NOT EXIST "!foldertmp!" (
mkdir "!foldertmp!"
)
endlocal
cd !Convertfolder!
Pal2PacE %inputdir%!file:~1! !filenametmp!
)
I used this answer to improve the for loop into:
for /f "delims=" %%A in ('for %%G in (.tga, .png) do 'forfiles /s /m *%%G /c "cmd /c echo @relpath"'') do (...
Unfortunately, it throws this error:
System cannot find file for %G in...
Does anyone know how to solve this?