I am just testing the code at the moment, although an exception is thrown when calling StartRemoveDuplicate (when it is compiled), complaining about invalid characters:

My code is as follows:
class Program { static void Main(string[] args) { foreach (string exename in System.IO.File.ReadAllLines("test.txt")) { Process.Start("test.exe", "\"" + exename + "\"").WaitForExit(); } StartRemoveDuplicate(); } private static void RemoveDuplicate(string sourceFilePath, string destinationFilePath) { var readLines = File.ReadAllLines(sourceFilePath, Encoding.Default); File.WriteAllLines(destinationFilePath, readLines.Distinct().ToArray(), Encoding.Default); } private static void StartRemoveDuplicate() { RemoveDuplicate("C:\test.txt", "C:\test2.txt"); } }
Michael
source share