iam using .bat code to check folder attribute if its ( Hidden + System ) then change it to ( Not Hidden + Not System ) "MTD" is Folder
Code:
if attrib +h +s "MTD" attrib -h -s "MTD"
Thanks
iam using .bat code to check folder attribute if its ( Hidden + System ) then change it to ( Not Hidden + Not System ) "MTD" is Folder
Code:
if attrib +h +s "MTD" attrib -h -s "MTD"
Thanks
Hi All i found solution
cls
@ECHO OFF
title Folder Locker
: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 UNLOCK
if %cho%==N goto UNLOCK
echo Invalid choice.
goto CONFIRM
:LOCK
attrib +h +s "MTD"
echo Folder locked
goto End
:UNLOCK
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%== 123 goto FAIL
attrib -h -s "MTD"
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:End
REWRITE With thanks to @Compo and a post from dbenham (https://stackoverflow.com/a/8669636/447901), this is completely rewritten. It is -very- hardcoded for specific character positions which is not a good idea.
When it appears that the correct
ATTRIB
commands will be run on the correct directories, remove theecho
from theATTRIB
command.This would be far better done in PowerShell. This will require the current PowerShell 5.x or higher. In fact...