Reputation: 528
I want to protect a file , i don't allow user can change it (only my app can change this) and can't delete. I know Windows Defender but it's not work perfect. I like something like this: first i have a txt file, this file's name is sample.txt
from protector import protect_with_lock
protect(file="sample.txt",password_lock="12345")
after i run this code this folder is emty.
from protector import unlock
unlock(file="sample.txt",password_lock="12345")
and this file is come back Thanks for help!
Upvotes: 2
Views: 1087
Reputation: 29
Steps to Lock and hide a folder.
@ECHO OFF
title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure u 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 Locker "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%==Enter-Your-Password-Here goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End
Upvotes: 0
Reputation: 149145
On any system, what a process can do only depends on the user id and not on the application. What you want would only be possible on a Unix-like where an application can run under a specific user thanks to the set user id feature. On Windows, the only possible way is to split the application :
Upvotes: 2