Windows 更改用户密码 GUI.ahk

Windows 更改用户密码 GUI.ahk

是否有一个 Windows 命令(通过命令行发送)可以打开“更改密码”窗口,如下所示。

答案1

control userpasswords2

上述命令将打开一个用户窗口,您可以选择重置密码

用户帐户窗口

答案2

您可以尝试以下几种方法。

微软表示control password.cpl应该可以从命令行运行,但我在非域控制计算机上的 Windows 7 中无法获得它。

使用该命令start control password.cpl也可能有帮助。

这是另一个命令尝试rundll32.exe shell32.dll,Control_RunDLL password.cpl

如果这些不起作用,你可以从命令行执行net user [username] [newpassword]

答案3

我用了自动热键为了这。

将变量更改user为目标用户。

保存该文件并在启动文件夹中创建该文件的快捷方式。

每一行末尾都有注释和;解释。

Windows 更改用户密码 GUI.ahk

#NoEnv
SetWorkingDir %A_ScriptDir%
#Warn
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
SetTitleMatchMode Fast
DetectHiddenWindows Off
DetectHiddenText On
#WinActivateForce
#NoTrayIcon
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
#Persistent
#MaxThreadsPerHotkey 2

WindowsChangeUserPasswordGUI:
user := "Administrator"  ; user
WinGetTitle, title, A  ; Active Window Enable On Top
WinGetClass, class, A  ; Active Window Enable On Top
WinGet, exe, ProcessName, A  ; Active Window Enable On Top
WinSet, AlwaysOnTop, On, %title% ahk_class %class% ahk_exe %exe%  ; Active Window Enable On Top
Run, netplwiz  ; User Accounts
WinWait, User Accounts ahk_class #32770 ahk_exe netplwiz.exe  ; User Accounts
WinSet, Transparent, 0, User Accounts ahk_class #32770 ahk_exe netplwiz.exe  ; Make User Accounts Window Transparent (Not Visible)
WinSet, AlwaysOnTop, Off, %title% ahk_class %class% ahk_exe %exe%  ; Active Window Disable On Top
ControlSendRaw, SysListView321, %user%, User Accounts ahk_class #32770 ahk_exe netplwiz.exe  ; Select Specified User
ControlGet, selected, List, Selected, SysListView321, User Accounts ahk_class #32770 ahk_exe netplwiz.exe  ; Get Selected User
selected := RegExReplace(selected, "\t.*", "")  ; Get Pure User Name, Remove User Groups
ControlClick, Button6, User Accounts ahk_class #32770 ahk_exe netplwiz.exe,, Left, 1,  NA  ; Reset Password Button
WinWait, Reset Password ahk_class #32770 ahk_exe netplwiz.exe  ; Reset Password
WinSetTitle, Reset Password ahk_class #32770 ahk_exe netplwiz.exe, , Reset Password %selected%  ; Set Window Title Reset Password User
WinGetPos, passX, passY, passW, passH, Reset Password ahk_class #32770 ahk_exe netplwiz.exe  ; Get Window Position Of Reset Password 
x := (A_ScreenWidth - passW) / 2  ; Set The Coordinates For Screen Center
y := (A_ScreenHeight - passH) / 2  ; Set The Coordinates For Screen Center
WinMove, Reset Password ahk_class #32770 ahk_exe netplwiz.exe,, %x%, %y%  ; Move Reset Password Window To Screen Center
WinWaitClose, Reset Password ahk_class #32770 ahk_exe netplwiz.exe  ; Wait For Reset Password Window To Close
WinClose, User Accounts ahk_class #32770 ahk_exe netplwiz.exe  ; Close User Accounts Window
ExitApp  ; ExitApp
Return

答案4

我再也看不到任何 Windows 机器上的 password.cpl;它可能已被弃用。但是,这个晦涩的命令似乎仍然可以用于启动密码对话框:

C:\Windows\explorer.exe shell:::{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}

希望对你有用。

相关内容