FileInfo fi = new FileInfo("c:\\www\\abc.jpg");
String Name = fi.Name;//文件名
String FileTitle = Name.TrimEnd(fi.Extension.ToCharArray());//没有扩展名的文件名

解决方案 »

  1.   

    我是说
    System.IO.FileInfo fia = new FileInfo("PMS.exe");
    MessageBox.Show(fia.DirectoryName);应该显示的是PMS.exe文件的地址(D:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\PMS\bin\Debug)但是,当我选择了C:\ 的图片a.jpg时候,他就显示了C:\  (应该是PMS.exe的地址啊)为什么!
      

  2.   

    你必须先说清楚你的问题人家才能帮你解决呀。
    比如:"但是,当我选择了C:\ 的图片a.jpg时候,他就显示了C:\"这是为什么呢?System.IO.FileInfo fia = new FileInfo("PMS.exe");
    MessageBox.Show(fia.DirectoryName);
    如果只指定文件名而没有目录的话,得到的DirectoryName当然是指当前目录,它不会判断在这个目录下这个文件是否存在。