http://pc12.2ch.net/test/read.cgi/tech/1268699491/855
using System;
using System.IO;
using System.Collections;

namespace _862
{
  class _862
  {
    static void Main(string[] args)
    {
      ArrayList files = new ArrayList();
      string[] fs =      //folderにあるファイルを取得する
        System.IO.Directory.GetFiles(Directory.GetCurrentDirectory(), "test*.cpp");
      files.AddRange(fs);    //ArrayListに追加する

      foreach (string file in files)
      {
        StreamReader sr = new StreamReader(file);
        string buffer = sr.ReadToEnd();
        sr.Close();

        StreamWriter sw = new StreamWriter(file);
        sw.Write("#include \"stdafx.h\"\r\n" + buffer);
        sw.Close();
      }
    }
  }
}