Click here to Skip to main content
15,886,007 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys,
How would I compile Batch Files (*.bat) into an exe with vb.net.
If possible, I would also like an icon setting function, and password protect.
I searched on Google; it only came up with compiling visual basic projects.

Regards,
iProgramIt
Posted
Comments
Sergey Alexandrovich Kryukov 24-Apr-15 0:19am    
Why?
—SA
Philippe Mori 25-Apr-15 20:52pm    
Write equivalent code from scatch. This is probably the best solution.

You'd have to write your own parser, compiler and function library to generate the .EXE.

The .NET Framework does not have any built in facility to do this for you.

Good luck!
 
Share this answer
 
Comments
iProgramIt 26-Apr-15 23:00pm    
I got it. But, what I did is I created the executable file, which then extracts the code for the bat and starts it.
Dave Kreskowiak 27-Apr-15 7:25am    
That's hardly a compiled batch file.
iProgramIt 27-Apr-15 20:26pm    
I know, but so far it is that that is only possible - for me anyway.
Generally, you cannot, but a pure logical solution would be compiling it into code which is mainly a sequence of the calls to System.Diagnostic.Process.Start. Calls to other batch files could be inlined, to have a blocking call. Of course, it needs to calculate the parameters of those calls, and imitate the instruction flow, including batch-file "call" (yes, there are calls, introduced with Window NT) and labels.

Does it makes any practical sense? I don't think so. It would be quite a work, without any useful outcome. Even inventing a brand-new scripting language, less archaic, and implementing it, would be a lot more useful. But would not advise going in for that, too.

—SA
 
Share this answer
 
Hi,
This post will really helps you.

Bat file compiler[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900