1

I cannot make my code blocks preserve indenting and empty lines.

For example, see my answer at Check remote file existence on multiple Windows servers.

Interestingly the same markup works as expected here on meta:

@echo off

set list=server1 server2 server3 server4 serverN

for %%s in (%list%) do (
    echo Logging in to %%s
    net use \\%%s\shared /user:mydomain\myuser password    

    echo Checking file existence on %%s
    if exist \\%%s\shared\file.txt (
        echo File exist on %%s
    ) else (
        echo File does NOT exist on %%s
    )

    echo Logging out
    net use \\%%s\shared /delete
)

What makes the differences?

6
  • 1
    Huh? I see the same thing here and there Apr 16, 2013 at 13:25
  • 1
    Looks OK to me. What browser and OS are you using?
    – Oded
    Apr 16, 2013 at 13:25
  • You are right. After looking back now, it does not work anymore even on meta. Using IE8 (corporate policy). I've checked now on iPhone Safari and it looks correct on both sites. Apr 16, 2013 at 13:32
  • Interestingly it's not consistent. I have this page opened in two tabs atm and on one tab it shows correctly, on the other, empty lines and indetation are lost. Anyway, disregard this, as it seems to be IE8 specific. Apr 16, 2013 at 13:35
  • I see the difference now, it's about "compatibility view". It's somehow automatically enabled for some tabs and disabled for other. When turned off, it works as expected. Apr 16, 2013 at 13:36
  • Voting to close as too localized - IE8 is not a supported browser.
    – yoozer8
    Apr 16, 2013 at 14:13

1 Answer 1

2

The problem is caused by Compatibility View mode of IE8.

When Compatibility View is off, the code block renders as expected.

Not the answer you're looking for? Browse other questions tagged .