cm84n7281 发表于 2016-6-28 16:19:21

代码如何取消弹出输入管理账户和密码对话框

以下代码只要在管理员运行,就不会出现截图中弹出对话框,在普通的账户下运行就出现截图中的对话框,以下的代码,如何设置才能普通的用户运行该脚本,不会有截图中的弹出对话框。
#RequireAdmin

if $cmdline>0 then
Select
   Case $cmdline="/s"
             reg()

                  _Update_Explorer()
                  Exit
         Case $cmdline="/s1"
                  reg()

                  Exit

         Case $cmdline<>"/s" And $cmdline<>"/s1"
               MsgBox(262144,"提示","运行参数错误!正确的是参数为/S或/S1")

               Exit

      EndSelect
EndIf
;-------------------------------无参数运行
reg()

         _Update_Explorer()
MsgBox(262144,"提示","WIN7 IE桌面图标创建完毕!")
;-------------------------------无参数运行结束

Func _Update_Explorer()

    Local $bOld = Opt("WinSearchChildren", True)

    Local $a = WinList("")

    For $i = 0 To UBound($a) - 1

      DllCall("user32.dll", "long", "SendMessage", "hwnd", $a[$i], "int", 0x111, "int", 28931, "int", 0)

    Next

    Opt("WinSearchChildren", $bOld)

EndFunc;==>_Update_Explorer

Func reg()

RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{00000000-0000-0000-0000-100000000001}')
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{00000000-0000-0000-0000-100000000001}', '', 'REG_SZ', 'Internet Explorer')

RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}')
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}', '', 'REG_SZ', 'Internet Explorer')

RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\DefaultIcon')
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\DefaultIcon', '', 'REG_SZ', '' & @SystemDir & '\ieframe.dll,-190')

RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell')
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell', '', 'REG_SZ', '')

RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\NoAddOns')
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\NoAddOns', '', 'REG_SZ', '无加载项启动(&N)')

RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\NoAddOns\Command')
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\NoAddOns\Command', '', 'REG_SZ', '"C:\Program Files\Internet Explorer\iexplore.exe" -extoff')

RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\Open')
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\Open', '', 'REG_SZ', '打开主页(&H)')

RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\Open\Command')
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\Open\Command', '', 'REG_SZ', '"C:\Program Files\Internet Explorer\iexplore.exe"')

RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\Set')
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\Set', '', 'REG_SZ', '属性(&R)')

RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\Set\Command')
RegWrite('HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-100000000001}\\shell\Set\Command', '', 'REG_SZ', '"' & @SystemDir & '\rundll32.exe" ' & @SystemDir & '\shell32.dll,Control_RunDLL ' & @SystemDir & '\inetcpl.cpl')

EndFunc
页: [1]
查看完整版本: 代码如何取消弹出输入管理账户和密码对话框