19

This question already has an answer here:

I have two Autorun.inf files, the code inside them are exact same. But only 1 works, other one doesn't work.

The one that work is copied from DVD, and i edited it. The one that doesn't work created on my desktop by renaming text file ( i correctly renamed it ).

This one works

enter image description here

This one doesn't work

enter image description here

If you want the files :

Working one : http://www16.zippyshare.com/v/64IutSu4/file.html

Not working one : http://www98.zippyshare.com/v/zEqU2BZ7/file.html

Does anyone know why doesn't the one i created on my desktop wont work? and how can i get it working? and whats the difference between those 2 file?

Thanks.

marked as duplicate by Canadian Luke, DavidPostill windows Feb 16 '16 at 22:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I opened both with a hex editor and they are quite different when looking at the hex values. Its easy enough to make a new one. Make a Autorun text file and type in the data, save the file and change the extension from txt to inf. – Moab Feb 16 '16 at 1:21
  • @Moab That's what i did but i saved it as "UTF-8 with an UTF-8 BOM" - (dxiv) and that was the issue. Thanks for the response :) – user4335407 Feb 16 '16 at 2:05
  • 1
    I would dissagree in them beeing exact copies. This is simply impossible IF they are. – Zaibis Feb 16 '16 at 14:46
  • The first file says "usb". The second file says "usbk". Look at the last lines. Seems like a simple typo. – ApproachingDarknessFish Feb 16 '16 at 22:17
35

The 2nd .inf, which doesn't work, appears to have been saved as UTF-8 with a UTF-8 BOM.

The UTF-8 BOM means that the file starts with the binary sequence EF BB BF (in hex). But Windows expects autorun.inf files to be plain text, so it won't recognize this one as such.

My advice is to choose the plain-text option in your text editor when saving .inf files or similar.

  • 2
    and this is why you do not use notepad for editing program files. – Thorbjørn Ravn Andersen Feb 16 '16 at 8:17
  • 4
    @ThorbjørnRavnAndersen i dont think notepad adds BOM. – Sharky Feb 16 '16 at 8:22
  • 1
    It doesn't, but it doesn't tell you about BOM either, and it will save it back in the same encoding as the original file. – Nelson Feb 16 '16 at 12:11
  • 1
    UTF8 is plain text. I presume that you are talking about ASCII. – fNek Feb 16 '16 at 15:33
  • 2
    It's not even the variable-length encoding that is the problem. It's that the "BOM" (which isn't really a BOM at all, because a BOM is only used to distinguish little-endian from big-endian encodings of 16-bit or larger Unicode) is not visible inside the editor. And the invisibility of the "BOM" is what makes it no longer plain text. – Monty Harder Feb 16 '16 at 19:59
32

As dxiv has said, this is caused by UTF-8 BOM.

The file editor you are using, Notepad++, can tell you the encoding of the file.

enter image description here

UTF-8 BOM adds header bytes to the file that breaks their compatibility with standard ASCII files, whereas UTF-8 without BOM (or just plain UTF-8) files are fully reverse compatible with standard ASCII file, assuming you do not use any UTF-8 characters.

Notepad++ also has a HEX editor plugin and you will be able to see these extra bytes with it:

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.