Dragon
Dragon

Reputation: 2481

How to compile batch file with resources to exe and run it with its exe in C#?

I have batch file and a folder with resources which include one executable file. This file in its turn uses these resources. I want to compile these resources (batch file, executable file and folder with resources) to one executable one. And after launch of this exe, my batch file inside should run with all the ensuing consequences.

I'd like to make it on C#. What should I begin with?

Upvotes: 0

Views: 776

Answers (2)

zmbq
zmbq

Reputation: 39023

@Jon's answer is correct, but you can save yourself the coding entirely - that's what self extractors do. Check out the WinZip Self Extractor for instance. It can do exactly what you want.

Upvotes: 0

Jon
Jon

Reputation: 437554

If you want to do it exactly as stated then a reasonable approach would be to package all your resources into one zip file, embed it as a binary resource in your C# executable and have the executable extract the resource, unzip the file into a temporary directory and run it from there with Process.Create.

Upvotes: 2

Related Questions