以下命令可以实现在命令行中设置用户属性为密码永不过期(需要安装wmic.exe环境,执行命令时,请将半角双引号中的“用户名”换成实际的用户名,windows7中验证通过):

wmic.exe UserAccount Where Name="用户名" Set PasswordExpires="false"


SX用户密码永不过期wmic.reg


Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]

"PasswordExpires"="C:\\Windows\\System32\\wbem\\WMIC.exe UserAccount Where Name='SX' Set PasswordExpires=false"