一个奇怪的问题,帮帮忙,马上结贴!!!
在.net的windows服务项目中,对系统文件夹中的内容(如Environment.SpecialFolder .Recent)做一些操作,是否需要什么特别的方法,
string recentPath = string.Empty ;
recentPath = Environment.GetFolderPath(Environment.SpecialFolder .Recent);
string[] files = Directory.GetFiles(recentPath);
try
{
foreach(string filePath in files)
{
File.Delete(filePath) ;
}
}
catch(Exception ex)
{
throw new Exception(ex.Message ) ;
}
上面这段代码我放到windows应用程序项目中可以实现代码功能,但是放到window服务项目中好像这段代码没有执行它的功能。