1、System.Windows.Forms.Application.StartupPath;
2、System.AppDomain.CurrentDomain.BaseDirectory;
3、System.Environment.CurrentDirectory;
以上bai三du种zhi方法都可以获取程dao序根目录,4102
string programPath=以上三者选一。
string volume = programPath.Substring(0, System.Windows.Forms.Application.StartupPath.IndexOf(’:’));
MessageBox.Show(volume);
例如:1653
string volume = System.Windows.Forms.Application.StartupPath.Substring(0, System.Windows.Forms.Application.StartupPath.IndexOf(’:’));
MessageBox.Show(volume);