本帖最后由 532918457 于 2022-4-21 12:37 编辑
#RequireAdmin
#Region ;**** 由 AccAu3Wrapper_GUI 创建指令 ****
#AccAu3Wrapper_Icon=F:\ICO\16.ico
#AccAu3Wrapper_OutFile_x64=一键激活win10.exe
#AccAu3Wrapper_Res_Language=2052
#AccAu3Wrapper_Res_requestedExecutionLevel=None
#EndRegion ;**** 由 AccAu3Wrapper_GUI 创建指令 ****
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIToolTip.au3>
#include <StaticConstants.au3>
#include <Process.au3>
Global Const $gc_FormName = "激活Win10"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate($gc_FormName, 177, 100, -1, -1)
GUISetBkColor(0xdeecfc)
Local $idComboBox1 = GUICtrlCreateCombo("", 10, 15, 155, 20)
Local $Btn1 = GUICtrlCreateButton("确定", 10, 50, 60, 24, $BS_DEFPUSHBUTTON)
Local $Btn2 = GUICtrlCreateButton("查看激活状态", 80, 50, 86, 24)
GUICtrlCreateLabel("By Simiya-L", -1, 80, 85, 20, $SS_RIGHT)
#EndRegion ### END Koda GUI section ###
_Main()
Exit
Func _Main()
GUICtrlSetData($idComboBox1, "激活win10(校内)|激活win10(校外)", "激活win10(校内)")
GUISetState(@SW_SHOW)
Local $nMsg
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Btn1
_Activation();激活win10
Case $Btn2
_ActivationStatus();查看激活状态
EndSwitch
WEnd
EndFunc ;==>_Main
Func _Activation()
Select
Case GUICtrlRead($idComboBox1) = "激活win10(校内)"
Local $Act1 = _RunDos("slmgr /skms kms.03k.org")
Sleep(2000)
ControlClick('Windows Script Host', '', 'Button1')
Local $Act2 = _RunDos("slmgr /ato")
TrayTip("", "系统激活完成", 5, 1)
Case GUICtrlRead($idComboBox1) = "激活win10(校外)"
RunWait(@ComSpec & "/c" & 'slmgr /skms kms.03k.org')
RunWait(@ComSpec & "/c" & 'slmgr /ato')
TrayTip("", "系统激活完成", 5, 1)
EndSelect
EndFunc ;==>_Activation
Func _ActivationStatus()
Local $ActSta = _RunDos("slmgr.vbs -xpr")
EndFunc ;==>_ActivationStatus
每次运行到图片的地方就要手动点击确定才可以运行下一条代码,我中间试过添加WinActivate的代码还是不行,代码应该卡在了 Local $Act1 = _RunDos("slmgr /skms kms.03k.org"),不点确定就不继续了,然后RunWait(@ComSpec & "/c" & 'slmgr /skms kms.03k.org')这一句是完全不起作用,不知到为什么,我测试的系统是windows10。
求各位大哥指教一下我这个学了两星期左右的萌新。
|