How to write .bat to exe file converter via Delphi?

    1 answer 1

    Option A.

    1. Write a parser that converts bat files to some internal representation.
    2. Write a compiler from this internal representation in PE, which will generate the appropriate machine code and form all the necessary PE headers and sections.

    Option B.

    1. Write a small program that saves the bat-file, which lies in its own data section into a temporary file and executes it with ShellExecute.
    2. To write an auxiliary utility that shoves an arbitrary bat-file into the data section of the program from point 1.

    Both tasks are very nontrivial, although option B is, of course, easier. Whether it is necessary?

    • Actually, I was thinking from the direction of Path B, but here's the problem. I don’t know how to create a temporary file and stuff the batch file code into it - Nikolay69 September