首页 新闻 会员 周边 捐助

C# 重置IE设置

0
悬赏园豆:30 [已解决问题] 解决于 2016-08-10 17:51

 用C#去实现这个重置功能。有没有知道怎么做的啊?求解啊!!!

Shen_小沈的主页 Shen_小沈 | 初学一级 | 园豆:56
提问于:2016-07-20 10:25
< >
分享
最佳答案
1

C#中执行下面的重置IE设置的PowerShell脚本(来源):

#+-------------------------------------------------------------------+   
#| = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = |   
#|{>/-------------------------------------------------------------\<}|            
#|: | Author:  Aman Dhally                                        | :|            
#| :| Email:   amandhally@gmail.com 
#|: | Purpose: Reset Internet Explorer Setting to Default   
#| :|       
#|: |  more info: http://newdelhipowershellusergroup.blogspot.in/                                                           
#| :|           
#|: |                 Date: 23 - July - 2012 
#|: |                            16:29 
#| :|     /^(o.o)^\    Version: 1                                    |: |  
#|{>\-------------------------------------------------------------/<}| 
#| = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = | 
#+-------------------------------------------------------------------+ 
 
 
## Load Assembly ## 
[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") 
#-  
 
"`n" 
Write-Host  "  ============================================" -ForegroundColor 'Green' 
Write-Host  "   [ Resetting IE To Default Settings]" -ForegroundColor 'Red'  
Write-Host  "  ============================================" -ForegroundColor 'Green' 
"`n" 
###  
"`n" 
 
$arrOfficeProcs = "iexplore" 
$continue = $false 
cls 
 
#Check for open Office apps 
do { 
    $arrRunning = @() 
     
    foreach ($proc in $arrofficeProcs) { 
        if(((get-process $proc -ea SilentlyContinue) -ne $Null)){ $arrRunning += $proc }        
    } 
         
    if ($arrRunning.length -gt 0 ) {   
        $d = [System.Windows.Forms.MessageBox]::Show( 
        "There are currently one or more Internet Explorer windows Open.`n`nYou must close down all Internet explorer windows before reset it to default.",  
        "Reset IE Settings to Default...",  
        [System.Windows.Forms.MessageBoxButtons]::RetryCancel,  
        [System.Windows.Forms.MessageBoxIcon]::Warning ) 
 
        if ($d -eq [Windows.Forms.DialogResult]::Cancel) { exit } 
 
    } else {  
        $continue = $true 
        write-host "  No IE process are currently running"  -ForegroundColor 'Green' 
        "`n" 
        Write-Host "  Please TICK on `"Delete personal Settings`" and then click on `"Reset`" button   <====" -ForegroundColor 'Yellow'  
        "`n" 
        & RunDll32.exe InetCpl.cpl,ResetIEtoDefaults | Out-Null 
        "`n" 
        Write-Host "  ====> Please Launch Internet Explorer Now" -ForegroundColor 'Magenta'  
         
 
"`n" 
Write-Host  "  ============================================" -ForegroundColor 'Green' 
Write-Host  "   [ Resetting Done]" -ForegroundColor 'Red'  
Write-Host  "  ============================================" -ForegroundColor 'Green' 
"`n" 
     
     
    } 
 
 
} while ( $continue -eq $false ) 
 
 
#### End of the Script #### A m a n     D h a l l y ---- amandhally@gmail.com
收获园豆:30
dudu | 高人七级 |园豆:29732 | 2016-07-20 10:54
其他回答(2)
0

http://www.2cto.com/kf/201401/276045.html

刘宏玺 | 园豆:14020 (专家六级) | 2016-07-20 10:37

这个主要是清理Cookies、IE临时文件、历史记录之类的,我都已经写了,我现在想知道怎么重置IE的设置,或者是怎么禁止IE的加载项也可以。

支持(0) 反对(0) Shen_小沈 | 园豆:56 (初学一级) | 2016-07-20 10:48

@SKY_Shen: http://www.cnblogs.com/D-Wade-WP8/archive/2013/05/09/wadeflash20140509.html

支持(0) 反对(0) 刘宏玺 | 园豆:14020 (专家六级) | 2016-07-20 10:53
0

C# IE环境 - 重置IE(WshShell & Rundll32) https://www.cnblogs.com/kybs0/p/10914512.html
C# 重置IE安全等级 https://www.cnblogs.com/kybs0/p/10951951.html

唐宋元明清2188 | 园豆:329 (菜鸟二级) | 2019-06-03 17:04
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册