/*方法2*/
using System.Diagnostics;
using System.IO;
Process p=new Process.GetCurrentProcess();
ProcessModule pm=p.MainModule;
string s=pm.ModuleName;
Console.WriteLine(Path.GetFullPath(s));//得到当前进程的路径;
Console.WriteLine(Path.GetDirectoryName(Directory.GetCurrentDirectory(s)));
using System.Diagnostics;
using System.IO;
Process p=new Process.GetCurrentProcess();
ProcessModule pm=p.MainModule;
string s=pm.ModuleName;
Console.WriteLine(Path.GetFullPath(s));//得到当前进程的路径;
Console.WriteLine(Path.GetDirectoryName(Directory.GetCurrentDirectory(s)));