9

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."

SO Error message

Update 3

It must be something in the network at work. I just tried it from home and it worked fine.

13
  • 4
    I just noticed an annoying beige popup box on the right of the post window that insisted on reminding me that I should post more than a code snippet. Completely oblivious to the fact that I wasn't done writing the post and not going away when I added text. Is that what you are talking about? Commented Feb 6, 2015 at 19:31
  • @HansPassant I would assume that's not it, considering "a red box saying there was problem posting" was specifically mentioned in the post. Aphoria, it would be beneficial if you can give the exact error message, unless all it said was "There was a problem posting."
    – Kendra
    Commented Feb 6, 2015 at 19:32
  • @HansPassant I didn't notice that message. But, I did have other text in my answer, so I maybe that message wasn't there for me to notice.
    – aphoria
    Commented Feb 6, 2015 at 19:48
  • @Kendra I agree about giving the exact error message, but I didn't write it down or capture when it happened on SO. I assumed when I posted the code here I'd get the same error message and then I could note the exact message. Oops. I'm not positive, but if not exact, the message was really close to "There was a problem posting".
    – aphoria
    Commented Feb 6, 2015 at 19:51
  • Perhaps try editing it on the SO post again and see if you still get the error? If you do, then you can indeed get the exact quote, or even a screenshot of the error box. And if you don't, you can probably chalk it up to some odd error between you and SO. :) (Maybe check your console if you get the error again and see if you got any odd error messages there as well.)
    – Kendra
    Commented Feb 6, 2015 at 19:52
  • 1
    @Kendra See my edit. Some more info and I got the actual error message.
    – aphoria
    Commented Feb 6, 2015 at 20:02
  • I hope you don't mind, but I attempted it myself (it should appear as a suggested edit) and didn't receive the error. If you wish to reject so you can keep it for testing/gathering any other information, please feel free.
    – Kendra
    Commented Feb 6, 2015 at 20:13
  • @Kendra I accepted your edit to see it and then rolled it back. Since you didn't see the error, I thought maybe it was browser specific. I've been working in Firefox 35.0.1 but I just got the same error in Chrome 41.
    – aphoria
    Commented Feb 6, 2015 at 20:19
  • It might be a network issue, something between you and SO. Do you have a mobile device you can try it on a mobile network with? Can you see any errors in the developer tools of either browser?
    – Kendra
    Commented Feb 6, 2015 at 20:22
  • 4
    If you have a firewall, it might block this as a code injection attempt.
    – Spokey
    Commented Feb 6, 2015 at 21:54
  • 1
    It must be something in the network at work. I just tried it from home and it worked fine. :(
    – aphoria
    Commented Feb 6, 2015 at 22:54
  • This question should be marked as status-norepo..
    – AStopher
    Commented Feb 7, 2015 at 23:12
  • 1
    @aphoria: probably a anti-hacking filter on your office network router or firewall is interrupting the POST. Same happens when trying to post SQL answers and certain firewalls and routers. Commented Feb 8, 2015 at 1:40

0

Browse other questions tagged .