[英]create folder and copy set of files to local disk
我正在尝试创建一个文件夹,并使用c#wpf应用程序将一些图像复制到其中。
curName = txt_PoemName.Text;
// Specify a "currently active folder"
string activeDir = @"C:\Program Files\Default Company Name\Setup2\Poems";
//Create a new subfolder under the current active folder
string newPath = System.IO.Path.Combine(activeDir, curName);
// Create the subfolder
System.IO.Directory.CreateDirectory(newPath);
foreach(DictionaryEntry entry in curPoem){
string newFilePath = System.IO.Path.Combine(newPath, entry.Key.ToString() + Path.GetExtension(entry.Value.ToString()));
System.IO.File.Copy(entry.Value.ToString(), newFilePath, true);
}
我已经成功创建了文件夹和图像。 我也可以通过应用程序访问它们。 但是我在本地磁盘上的位置看不到它们。 当我重启机器时,应用程序也看不到它们。我该如何解决?
听起来您遇到了UAC数据重定向http://blogs.windows.com/windows/b/developers/archive/2009/08/04/user-account-control-data-redirection.aspx
您需要强制应用程序以管理员身份运行。 如何强制.NET应用程序以管理员身份运行?
还是不将您的数据保存在敏感区域。 我建议保存在以下子文件夹中
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.