Friday, November 23, 2012

C# Tutorial: How to create a program that self replicates!

// Namespaces that you need
using System.Diagnostics;
using System.IO;

// The Replication Code
for (int i = 1; i <= 5; i++)
{
    string exec = Application.ExecutablePath;
    exec = exec.Insert(exec.IndexOf("."), i.ToString());
    File.Copy(Application.ExecutablePath, exec);
    Process.Start(exec);
}
// You can replace 5 with whatever number you want
// However, be carefull!

18 comments:

  1. Hi, I have no idea on how to contact you so I am using this post to do so.

    I'm a programmer who is working on a series of tutorials whenever I can that will take a beginner and allow them to begin to grasp and understand how to program.

    The only issue is getting what I make out there.

    I was wondering if maybe you could give me some help by giving a shout about my site, http://debugging-code.blogspot.com/

    If not, feel free to delete this post.

    ReplyDelete
  2. Great blog..You have clearly explained about the concept..Step by step explanation is too good to understand..Its very useful for me to understand..Keep on sharing..
    Hadoop training in chennai

    ReplyDelete
  3. Excellent .. Amazing .. I will bookmark your blog and take the feeds additionally? I’m satisfied to find so many helpful information here within the put up, we want work out extra strategies in this regard, thanks for sharing..

    Hadoop Training in Chennai

    ReplyDelete



  4. That is very interesting; you are a very skilled blogger. I have shared your website in my social networks..!


    Online Reputation Management

    ReplyDelete


  5. What an awesome post, I just read it from start to end. Learned something new after a long time.

    AWS training in Chennai

    ReplyDelete
  6. This is my first visit to your blog, your post made productive reading, thank you. dot net training in chennai

    ReplyDelete
  7. Wonderful blog.. Thanks for sharing informative blog.. its very useful to me..

    iOS Training in Chennai

    ReplyDelete
  8. You post explain everything in detail and it was very interesting to read. Thank you. nata coaching centres in chennai

    ReplyDelete
  9. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

    digital marketing company in india

    ReplyDelete
  10. Great post! I am actually getting ready to across this information, It's very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    House Cleaning Service in Chennai

    ReplyDelete
  11. It's like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you can do with some pics to drive the message home a little bit, but instead of that, this is fantastic blog. A great read. I will definitely be back.
    Office Interiors in Chennai

    ReplyDelete
  12. Really, these quotes are the holistic approach towards mindfulness. In fact, all of your posts are. Proudly saying I’m getting fruitfulness out of it what you write and share. Thank you so much to both of you.
    Pest Control in Chennai
    Security Services in Chennai

    ReplyDelete

  13. Wonderful blog.. Thanks for sharing informative Post. Its very useful to me.

    Installment loans
    Payday loans
    Title loans

    ReplyDelete

  14. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your

    feed and I hope you post again soon.

    Android App Development Company

    ReplyDelete
  15. Your blog is very useful for me,I really like you post.Thanks for sharing.
    gclub casino
    goldenslot
    Gclub จีคลับ

    ReplyDelete