//選擇文件夾 FolderBrowserDialog dia = new FolderBrowserDialog(); if (dia.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string filePath = dia.SelectedPath; Directory.Exists(filePath);//判斷文件夾是否存在 } //選擇文件 OpenFileDialog dia = new OpenFileDialog(); if (dia.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string filePath = dia.SelectedPath; File.Exists(filePath);//判斷文件是否存在 }