标题: 一个设置系统用户自动登陆的小工具
[打印本页]
作者: 112183883
时间: 2007-1-6 13:58
标题: 一个设置系统用户自动登陆的小工具
每次设置系统用户自动登陆都要去翻注册表,比较麻烦,所以今天就花了点时间写了一个小脚本,功能很单一,有需要的朋友可以下载试试。代码如下:
on error resume next
dim welcomeinfo
welcomeinfo=msgbox("本工具将帮助你设置Windows自动登陆用户,是否继续?",1,"提示信息")
if welcomeinfo<>1 then wscript.quit
dim wshshell
dim rootkey
dim userkey
dim passwordkey
dim logonkey
dim username
dim password
dim tsinfo
do
username=inputbox("请输入你的用户账号:","提示信息")
if username="" then
tsinfo=msgbox("用户账号不能为空,要重新输入吗?",1,"提示信息")
if tsinfo<>1 then wscript.quit
end if
loop until username<>""
password=inputbox("请输入你的用户密码:","提示信息")
set wshshell=createobject("wscript.shell")
rootkey="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"
userkey=rootkey & "\DefaultUserName"
passwordkey=rootkey & "\DefaultPassWord"
logonkey=rootkey & "\AutoAdminLogon"
wshshell.regwrite userkey,username
wshshell.regwrite passwordkey,password
wshshell.regwrite logonkey,"1"
if err then
msgbox "设置失败,请重试!",,"提示信息"
err.clear
else
msgbox "设置成功!",,"提示信息"
end if
set wshshell=nothing
Last edited by 112183883 on 2007-1-6 at 02:04 PM ]
附件
1:
AutoAdminLogon.rar (2007-1-6 13:58, 665 bytes, 下载附件所需积分 1点
,下载次数: 141)
作者: dikex
时间: 2007-1-6 14:20
其实运行control userpasswords2,把要使用本机需要密码的勾去掉,确定后输入帐户和密码即可
另外楼主使用的是脚本,如果使用批处理和reg命令会更简单
@echo off
set /p um=输入登陆的帐号:
set /p up=输入帐号的密码:
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUserName" /t REG_SZ /d "%um%" /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /t REG_SZ /d "%up%" /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminlogon" /t REG_SZ /d "1" >nul
作者: baomaboy
时间: 2007-1-8 06:35
rundll32 netplwiz.dll,UsersRunDll
也可以
作者: utem999
时间: 2007-1-8 09:02
Originally posted by dikex at 2007-1-6 14:20:
其实运行control userpasswords2,把要使用本机需要密码的勾去掉,确定后输入帐户和密码即可
另外楼主使用的是脚本,如果使用批处理和reg命令会更简堮..
好像少了个 /f 的参数
作者: vgwxz
时间: 2009-5-25 01:25
正好需要用到 謝謝
作者: zgrhcf
时间: 2009-5-26 14:12
Originally posted by dikex at 2007-1-6 14:20:
其实运行control userpasswords2,把要使用本机需要密码的勾去掉,确定后输入帐户和密码即可
另外楼主使用的是脚本,如果使用批处理和reg命令会更简 ...
二楼的你的代码少一个/F,应该是如下:
@echo off
set /p um=输入登陆的帐号:
set /p up=输入帐号的密码:
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v "DefaultUserName" /t REG_SZ /d "%um%" /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v "DefaultPassword" /t REG_SZ /d "%up%" /f >nul
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v "AutoAdminlogon" /t REG_SZ /d
"1" >nul
作者: slore
时间: 2009-5-26 16:16
control设置的好像密码不在注册表显示吧
作者: Pierre
时间: 2009-5-26 22:32
Originally posted by dikex at 2007-1-6 14:20:
其实运行control userpasswords2,把要使用本机需要密码的勾去掉,确定后输入帐户和密码即可
另外楼主使用的是脚本,如果使用批处理和reg命令会更简 ...
汗。。。这个命令想了好久就是想不起来,所以这几年一直用的是:
rundll32 netplwiz.dll UsersRunDll
作者: azziporah
时间: 2009-7-27 09:30
Vista和Win 7下找不到这几个键了……
有人知道改在哪里了么?
作者: aksck
时间: 2009-8-18 09:50
好东西,下了
作者: uiopuiop
时间: 2009-8-18 13:32
标题: to 6 楼:
是不是应该把HKEY_LOCAL_MACHINE 替换成HKLM
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" 。。。。。。
REG ADD KeyName
KeyName FullKey
Machine Name of remote machine - omitting defaults to the current
machine Only HKLM and HKU are available on remote machines
FullKey ROOTKEY\SubKey
ROOTKEY
作者: lovexywy
时间: 2010-8-27 11:52
正需要。。。下来看看。