我無法通過CMD執行我的應用程序,當應用程序試圖讀取它發送給它(文本文件),它失敗的說法...廣東話運行的應用程序(C#)通過CMD
當我試圖通過IDE(VS2008)來執行它,它的工作原理確定...
這就是我在main
方法做:
static void Main(string[] args)
{
int choice = 0;
if (args.Length == 0)
choice = 1;
else
choice = 2;
switch(choice)
{
case 1:
string[] text = Directory.GetFiles("allText");
Console.WriteLine(DateTime.Now.ToString());
foreach (string fileName in text)
{
string substring = fileName.Substring(8);
ReadData_Logic rd_l = new ReadData_Logic(substring);
rd_l.runThreadsAndDecrypt();
rd_l.printKey(substring.Substring(0, fileName.Length - 15).Insert(0, "encryptedKey\\") + "_result.txt");
}
Console.WriteLine(DateTime.Now.ToString());
break;
case 2:
Console.WriteLine(DateTime.Now.ToString());
string fileName = args[0];
Console.WriteLine(fileName); **<--- for debug, here i do see the correct file name**
ReadData_Logic rd_l = new ReadData_Logic(fileName);
rd_l.runThreadsAndDecrypt();
rd_l.printKey(fileName + "_result.txt");
Console.WriteLine(DateTime.Now.ToString());
break;
}
}
有什麼不好的代碼? 謝謝
請告訴我們它是如何失敗的。你得到什麼樣的錯誤/異常? – 2010-03-31 18:43:04
你如何從cmd.exe啓動你的應用程序?向我們展示一個例子!怎麼了? – 2010-03-31 18:58:39