打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
C# 清理IE缓存文件实例代码-程序开发-红黑联盟
C# 清理IE缓存文件实例代码
文章录入:王子    责任编辑:7747.Net  25
【字体:
C# 清理IE缓存文件实例代码如下:
using System; using System.IO; using System.Windows.Forms; using System.Text.RegularExpressions; namespace WinFormTemp {     public partial class FormTemp : Form     {         public FormTemp()         {             InitializeComponent();             this.HelpButton = true;             this.MaximizeBox = false;             this.MinimizeBox = false;             this.AutoSizeMode = AutoSizeMode.GrowAndShrink; // 禁用手动调整大小。             this.SizeGripStyle = SizeGripStyle.Hide; // 隐藏调整大小手柄。             this.StartPosition = FormStartPosition.CenterScreen; // 在桌面居中显示。         }         protected override void OnLoad(EventArgs e)         {             base.OnLoad(e);             DirectoryInfo dir = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));             foreach (FileInfo info in dir.GetFiles("*.*", SearchOption.AllDirectories))             {                 if (Regex.IsMatch(info.Extension, @".(dat|ini)", RegexOptions.IgnoreCase)) // 指定不区分大小写的匹配。                     continue;                 try                 {                     info.Delete();                 }                 catch                 {                     continue;                 }             }             System.Diagnostics.Process.Start(dir.FullName);         }         protected override void OnHelpButtonClicked(System.ComponentModel.CancelEventArgs e)         {             base.OnHelpButtonClicked(e);             e.Cancel = true;             FileInfo info = new FileInfo("Clear.bat");             if (info.Exists)                 info.Attributes = FileAttributes.Normal;             using (StreamWriter sw = info.CreateText())             {                 sw.WriteLine("@echo off");                 sw.Write(@"del /f /s /q ""{0}""", Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));             }             System.Diagnostics.Process.Start(info.DirectoryName);         }     } }
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
C#中文件操作【File】和【Directory】
浅析C#中的文件操作
LINQ和文件目录
Extjs 文件上传功能
DirectoryInfo对比Directory
C#文件操作
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服