C# 重置IE安全等级

打开IE设置-安全

 1     dynamic shellObject = Interaction.CreateObject("WScript.Shell", "");  2     //打开IE设置-安全
 3     shellObject.Run("Rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,1");  4     await Task.Delay(500);  5     //默认级别
 6     shellObject.SendKeys("{TAB}");  7     shellObject.SendKeys("{TAB}");  8     shellObject.SendKeys("{TAB}");  9     shellObject.SendKeys("{TAB}"); 10     shellObject.SendKeys("{R}"); 11 
12     await Task.Delay(100); 13     shellObject.SendKeys("{TAB}"); 14     shellObject.SendKeys("{TAB}"); 15     shellObject.SendKeys("{TAB}"); 16     shellObject.SendKeys("{A}"); 17 
18     await Task.Delay(100); 19     shellObject.SendKeys("{ENTER}");

如上步骤以下,html

  1. 打开IE设置-安全 Tab
  2. 等待窗口焦点转移(0.5ms) -- 由于当前的焦点,是在界面触发点位置,好比按钮
  3. 模拟手动操做,将安全级别重置为默认级别
  4. 模拟手动操做,点击应用
  5. 关闭选项窗口

如上步骤中,等待的时间并不是必定的,是我的根据调试结果,设置的一个貌似OK的值。git

 

Rundll32 Commands 列表参考:List of Rundll32 Commands in Windows 10github

Github地址:IE环境修复工具shell

相关文章
相关标签/搜索