1

I've got a program which is supposed to open files of a custom file type using file association. When doing it from inside the program, it does work correctly. But trying "Open with..." gives me an Error at line 1, Pos 2:Unexpected token (MZ) encountered.

Here's the file's content:

{
    "id" : "favouritecar",
    "hinweis" : "",
    "fragen" : {
            "0" : ["Car?", "Rolls-Royce", "Ford"]
    }
}

What is MZ and how can I remove it from the respective file?

Pixelcode
  • 357
  • 3
  • 15
  • 4
    `MZ` is the first two bytes of an executable. Apparently you are trying to parse an exe as json. Probably you are passing that same program's exe for it to parse, because you didn't set up the file association correctly. – GSerg May 04 '21 at 22:30
  • @GSerg Thanks for the info! – Pixelcode May 04 '21 at 22:43

1 Answers1

1

The characters MZ are the first two bytes of .exe files.

https://en.m.wikipedia.org/wiki/DOS_MZ_executable

Sounds like however you’re launching the program, it’s trying to read itself as input. Check how you’re formatting the command line.

Zoë Peterson
  • 13,094
  • 2
  • 44
  • 64
  • Thank you! Accidentally, I looped through the paramter count starting from 0 but it actually starts at 1. That's probably why the program wanted to read itself. After fixing that, I don't get the error anymore. – Pixelcode May 04 '21 at 22:47