If I attempt to post the code below as just a code sample, I get an error (a red box saying there was problem posting). If I wrap the code sample inside a blockquote it works.
The SO question is Batch - Forfiles in loop with multiple file types.
Code sample & Blockquote
for %%G in (.tga, .png) do ( for /f "delims=" %%A in ('forfiles /s /m *%%G /c "cmd /c echo @relpath"') do ( ' The ECHO below is just for testing. ' Put the code from inside your FOR loop here. ECHO %%A ) )
Just code sample
for %%G in (.tga, .png) do (
for /f "delims=" %%A in ('forfiles /s /m *%%G /c "cmd /c echo @relpath"') do (
' The ECHO below is just for testing.
' Put the code from inside your FOR loop here.
ECHO %%A
)
)
Update
I didn't get the error when posting this question on Meta. But, when I was trying to post the code as part of an answer on SO I repeatedly got the error. I narrowed it down to the quote marks around "cmd /c echo @relpath"
. If I removed those, I didn't get the error.
Update 2
I went back to my SO answer to attempt to debug the problem. If I added the code there in a code sample inside of a blockquote and then added the same code again in just a code sample, it would post just fine. That explains why I didn't see the error here.
The exact error message is a red box that says "An error occurred submitting the edit."
Update 3
It must be something in the network at work. I just tried it from home and it worked fine.
status-norepo
..