如何使单击文件时出现批处理文件?

发布于 2024-12-11 07:50:16 字数 91 浏览 0 评论 0原文

有没有办法在右键或左键单击文件时执行批处理文件?我想制作一个密码批处理文件,它将提示用户输入密码才能打开或编辑该特定文件。如果该人弄错了,那么他将无法编辑或打开该文件。

Is there a way to execute a batch file when you right or left click a file? I want to make a password batch file that will prompt the user for a password in order to open or edit that specific file. If the person gets it wrong then he can't edit nor open the file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

东北女汉子 2024-12-18 07:50:16

反过来说,是的。该脚本将创建一个私人文件夹供您存储文档,并在允许访问之前提示输入密码。

cls
@ECHO OFF
title Folder Private
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== PASSWORD_GOES_HERE goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Private
echo Private created successfully
goto End
:End 

请参阅此链接此链接了解更多信息。

In a round about way, yes. This script will create a private folder for you to store documents in and will prompt for a password before allowing access to it.

cls
@ECHO OFF
title Folder Private
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== PASSWORD_GOES_HERE goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Private
echo Private created successfully
goto End
:End 

See this link and this link for more info.

暮年 2024-12-18 07:50:16

为什么不使用像GPG这样的真正的加密呢?就像真正的保安人员。

你的想法,即使它是可能的(我不相信它是)也是微不足道的,只需在它打开的任何应用程序中直接打开该文件即可。

实际上,比这更糟糕的是,您的建议会泄露密码,因为它必须位于 bat 文件中的某个位置。

Why not use real encryption like GPG? It's like, actual security man.

Your idea, even if it were possible (and I don't believe it be) is trivially defeatable, just open the file directly in whatever app it opens with.

Actually, it's worse than that, your suggestion would REVEAL the password, because it would have to be in the bat file somewhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文