[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
写一个简单的ahk脚本
  1. #Persistent
  2. #NoTrayIcon
  3. password := "123456" ;设置密码
  4. SetTimer, BlockWindow, 800
  5. Return
  6. BlockWindow:
  7. if WinExist("ahk_class CabinetWClass"){
  8.     WinClose
  9.     WinClose
  10.     InputBox, input_password, 文件资源管理器, 请输入密码 只验证一次
  11.     if (input_password = password) {
  12.         Run, explorer.exe
  13.         ExitApp
  14.     } else {
  15.         MsgBox,, 密码错误
  16.     }
  17. }
复制代码
1

评分人数

TOP

回复 10# FU586097


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

评分人数

TOP

回复 15# FU586097


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

TOP

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

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

评分人数

TOP

回复 22# FU586097


    修改了一下,可以实现设置和修改密码
  1. #NoTrayIcon
  2. #Persistent
  3. SendMode Input
  4. SetWorkingDir, C:\Users\Public\Documents ;密码文件目录
  5. If !FileExist(".password") {
  6.         SetPassword()
  7.     }
  8. SetTimer, BlockWindow, 500
  9. Return
  10. BlockWindow:
  11. if WinExist("ahk_class CabinetWClass"){
  12.     WinClose
  13.     Gui, Destroy
  14.     WinClose
  15.     If !FileExist(".password") {
  16.         SetPassword()
  17.     }
  18.     Gui, Add, Text, w250 h30, 请输入密码 只验证一次:
  19.     Gui, Add, Edit, Password w230 vPassword
  20.     Gui, Add, Button, Default w100 h50 gCheckPassword, 确定
  21.     Gui, Add, Button, w100 h50 gButtonChangePassword, 修改密码
  22.     Gui, Show, w250 h200
  23.     Return
  24. }
  25. SetPassword()
  26. {
  27.     InputBox, input_password, 设置密码, 请设置密码
  28.     FileDelete, .password
  29.     FileAppend, %input_password%, .password
  30.     FileSetAttrib, +H, .password
  31. }
  32. Return
  33. ChangePassword()
  34. {
  35.     FileReadLine, stored_password, .password, 1
  36.     InputBox, current_password, 修改密码, 请输入当前密码
  37.     if (current_password = stored_password) {
  38.         InputBox, new_password, 修改密码, 请输入新密码
  39.         FileDelete, .password
  40.         FileAppend, %new_password%, .password
  41.         FileSetAttrib, +H, .password
  42.         MsgBox,, 密码修改成功
  43.     } else {
  44.         MsgBox,, 当前密码错误
  45.     }
  46. }
  47. Return
  48. CheckPassword:
  49. Gui, Submit
  50. FileReadLine, stored_password, .password, 1
  51. if (password = stored_password) {
  52.     Run, explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
  53.     ExitApp
  54. } else {
  55.     MsgBox,, 密码错误
  56. }
  57. Return
  58. ButtonChangePassword:
  59. ChangePassword()
  60. Return
复制代码
1

评分人数

TOP

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

回复 25# FU586097


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

TOP

回复 28# FU586097


    这个原理是检测窗口,按你的需求最好的方法就是设置权限。排除h盘就把第12行改成
  1. if WinExist("ahk_class CabinetWClass",,, "地址: H:"){
复制代码
然后把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

返回列表