得知目前執行檔所在的目錄? (.NET) (C#)
using System;
using System.IO;

class Client {
  static void Main() {
    string path = Directory.GetCurrentDirectory();
    Console.WriteLine(path);
  }
}

 

************************************************************
Dim strAppDir As String = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules(0).FullyQualifiedName)

需要Imports以下NameSpace
Imports System.IO
Imports System.Reflection

資料來源:http://msdn2.microsoft.com/zh-tw/library/ms229654.aspx


arrow
arrow
    全站熱搜

    Roger 發表在 痞客邦 留言(0) 人氣()