找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
楼主: FU586097

[系统相关] 批处理如何设置密码锁定此电脑和资源管理器?

[复制链接]
 楼主| 发表于 2023-6-19 20:36:24 | 显示全部楼层
师傅 你好  忘记密码了  怎样修改  谢谢


#NoTrayIcon
#Persistent
SendMode Input
SetWorkingDir, C:\Users\Public\Documents ;密码文件目录
If !FileExist(".password") {
        SetPassword()
    }
SetTimer, BlockWindow, 500
Return

BlockWindow:
if WinExist("ahk_class CabinetWClass",,,"地址: I:") and WinExist("ahk_class CabinetWClass",,,"地址: R:") {
    WinClose
    Gui, Destroy
    WinClose
    If !FileExist(".password") {
        SetPassword()
    }
    Gui, Add, Text, w250 h30, 请输入密码 只验证一次:
    Gui, Add, Edit, Password w230 vPassword
    Gui, Add, Button, Default w100 h50 gCheckPassword, 确定
    Gui, Add, Button, w100 h50 gButtonChangePassword, 修改密码
    Gui, Show, w250 h200
    Return
}

SetPassword()
{
    InputBox, input_password, 设置密码, 请设置密码
    FileDelete, .password
    FileAppend, %input_password%, .password
    FileSetAttrib, +H, .password
}
Return

ChangePassword()
{
    FileReadLine, stored_password, .password, 1
    InputBox, current_password, 修改密码, 请输入当前密码
    if (current_password = stored_password) {
        InputBox, new_password, 修改密码, 请输入新密码
        FileDelete, .password
        FileAppend, %new_password%, .password
        FileSetAttrib, +H, .password
        MsgBox,, 密码修改成功
    } else {
        MsgBox,, 当前密码错误
    }
}
Return

CheckPassword:
Gui, Submit
FileReadLine, stored_password, .password, 1
if (password = stored_password) {
    Run, explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
    ExitApp
} else {
    MsgBox,, 密码错误
}
Return

ButtonChangePassword:
ChangePassword()
Return
发表于 2023-6-19 21:27:48 | 显示全部楼层
回复 46# FU586097


    start "" notepad C:\Users\Public\Documents\.password

评分

参与人数 1技术 +1 收起 理由
FU586097 + 1 强大

查看全部评分

 楼主| 发表于 2023-6-19 21:59:25 | 显示全部楼层
回复 47# buyiyang


    谢谢师傅  明白  谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-18 02:28 , Processed in 0.023311 second(s), 7 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表