有時我們需要打開相對路徑下的應用程序,可以使用下面的方法:
Process info = new Process();
p.StartInfo.FileName = Application.StartPath+@"";
p.StartInfo.WorkingDirectory = @"";
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = false;
p.Start();
System.Environment.CurrentDirectory 獲取和設置當前目錄(該進程從中啟動的目錄)的完全限定目錄。
System.IO.Directory.GetCurrentDirectory() 獲取應用程序的當前工作目錄。
System.AppDomain.CurrentDomain.BaseDirectory 獲取程序的基目錄。
新聞熱點
疑難解答