返回列表 发帖
写一个简单的ahk脚本
#Persistent
#NoTrayIcon
password := "123456" ;设置密码
SetTimer, BlockWindow, 800
Return
BlockWindow:
if WinExist("ahk_class CabinetWClass"){
    WinClose
    WinClose
    InputBox, input_password, 文件资源管理器, 请输入密码 只验证一次
    if (input_password = password) {
        Run, explorer.exe
        ExitApp
    } else {
        MsgBox,, 密码错误
    }
}COPY
1

评分人数

TOP

回复 10# FU586097


    第12行改成
Run, explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}COPY
1

评分人数

TOP

回复 15# FU586097


    你先确定你在锁住的情况下能用win+e打开再说吧,不要虚构一个需求出来

TOP

能增加阻止  windows+e 打开吗
锁住的情况下用 windows+e 不能打开

你要求增加阻止windows+e打开,但实际上本来就有阻止windows+e打开的功能。
1

评分人数

TOP

回复 22# FU586097


    修改了一下,可以实现设置和修改密码
#NoTrayIcon
#Persistent
SendMode Input
SetWorkingDir, C:\Users\Public\Documents ;密码文件目录
If !FileExist(".password") {
        SetPassword()
    }
SetTimer, BlockWindow, 500
Return
BlockWindow:
if WinExist("ahk_class CabinetWClass"){
    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()
ReturnCOPY
1

评分人数

TOP

本帖最后由 buyiyang 于 2023-4-2 15:28 编辑

回复 25# FU586097


    这样还是建议新建账户设置权限。

TOP

回复 28# FU586097


    这个原理是检测窗口,按你的需求最好的方法就是设置权限。排除h盘就把第12行改成
if WinExist("ahk_class CabinetWClass",,, "地址: H:"){COPY
然后把h盘的快捷方式放桌面。

TOP

回复 30# FU586097


    你为什么要把你要限制其他人访问的文件发送到桌面?

TOP

回复 34# FU586097


    确实比较麻烦,或许你可以用一些专门的文件锁软件。
1

评分人数

TOP

回复 37# FU586097


    把脚本放到shell:startup目录里,开机自启
1

评分人数

TOP

回复 40# FU586097


    我不会

TOP

回复 43# FU586097


    微信号发我

TOP

回复 46# FU586097


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

评分人数

TOP

返回列表