Convert .bat to .exe in C #

3

I have an application in that creates a% % co that prints "Hello World". I want to know how to convert this file .bat to .bat from my own application, without using other software.

In case this is not possible, how to make a .exe that accepts the commands that are used in .exe .

    
asked by Marcus Declementi 10.09.2016 в 10:25
source

2 answers

1

I do not know what utility you're going to give your project. But a program in c # that creates a .bat and then converts it to .exe, is a bit strange.

According to my little experience a .bat there are pages that convert it to .exe link

If what you want is to execute from c # directly a .bat, it would be something like this: System.Diagnostics.Process.Start (@ "c: \ my_file.bat");

And finally I do not understand the need for the intermediate step to .bat because from c # you could also run an .exe

(ps: if this is for some type of program that creates some type of virus, the .exe bad results will give you because it detects any antivirus)

I hope something helps you.

    
answered by 10.09.2016 в 11:33
0

Check out these links:

StackOverflow - Convert BAT to EXE without external tools

Superuser - How can I convert to batch to a Exe

For reference:

  

A batch file is a batch file. These are plain text files, saved with the .BAT extension that contain a set of MS-DOS instructions. When this file is executed, the contained orders are executed in group, sequentially, allowing to automate diverse tasks. Any command recognizable by MS-DOS can be used in a batch file.   ...   A batch type is a text file that contains commands to be executed in a DOS or OS / 2 command interpreter. When it is started, a shell program - typically command.com or cmd.exe - reads and executes it, usually line by line. In this way, it is used to execute series of commands automatically. The fact that it works only for MS-DOS makes it very limited. Its extension is .bat or .cmd.   Source: link

On the other hand, an EXE file is a program written in a programming language "compiled "a machine language that is, in a language understood by the hardware.

I would recommend writing in C # the program you require instead of using a batch is usually simpler, you can also send a batch from an EXE as already published @Chema_MM.

Luck

    
answered by 12.09.2016 в 19:18