Is there any way to run command prompt commands from within a C# application? If so how would I do the following:
copy /b Image1.jpg + Archive.rar Image2.jpg
This basically embeds an RAR file within JPG image. I was just wondering if there was a way to do this automatically in C#.
with a reference to
Microsoft.VisualBasic
you can use simply write the code in a
.bat
format extension ,the code of the batch file :c:/ copy /b Image1.jpg + Archive.rar Image2.jpg
use this c# code :
Process.Start("file_name.bat")
Tried @RameshVel solution but I could not pass arguments in my console application. If anyone experiences the same problem here is a solution:
Yes, there is (see link in Matt Hamilton's comment), but it would be easier and better to use .NET's IO classes. You can use File.ReadAllBytes to read the files and then File.WriteAllBytes to write the "embedded" version.
Here is little simple and less code version. It will hide the console window too-