Batch script helps to combine the DOS commands and execute it in complex and well arranged mode. Any command that can be executed or typed in DOS(Command prompt) window can be executed and programmed using batch script. In today’s post I am going to utilize the loophole of windows.
Windows unknowingly supplies the following virtual folders:
Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}
Dial-Up Networking.{992CFFA0-F557-101A-88EC-00DD010CCC48}
Printers.{2227A280-3AEA-1069-A2DE-08002B30309D}
Inbox.{00020D75-0000-0000-C000-000000000046}
My Computer.{20D04FE0-3AEA-1069-A2D8-08002B30309D}
Recycle Bin.{645FF040-5081-101B-9F08-00AA002F954E}
Network Neighborhood.{208D2C60-3AEA-1069-A2D7-08002B30309D}
Desktop.{00021400-0000-0000-C000-000000000046}
Briefcase.{85BBD920-42A0-1069-A2E4-08002B30309D}
Fonts.{BD84B380-8CA2-1069-AB1D-08000948F534}
Whenever you rename your folder with any of the above name and supply hidden and system folder attributes to it, it becomes completely invisible and inaccessible also in index-able bywindows search.
For example rename NEW FOLDER to “’Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” (without quotes).
Now open Command prompt and open the currently renamed New Folder. Set the attributes to +h +s +i
H=Hidden
S=System File
I=Un-indexed
To set attributes input the following syntax (see the image).
There you go, your folder is invisible now and inaccessible.
The above tutorial was just for demonstration. Now I am going to show you how you can arrange it in batch file so that you show and hide the folder just by double clicking a secret icon.
Follow and learn this step by step tutorial.
NOTE: Just copying and pasting codes won’t make you a good batch scripter, you’ll have to learn and modify the techniques used in them.
First of all let’s plan for the script. What the script must do is check if folder named “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” exists or not. If it exists then we’ll have to direct our program such a way that it will prompt to show or hide the folder. Otherwise if the folder doesn’t exists let the program create new folder with any name (say “Secured”)
The above idea can be formulated in this way:
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST secured goto MDLOCKER
If there is no matching folder then as soon as the program is executed secured folder will be created. Where MDLOCKER is the separate case (block of code) to create new folder named secured. This time the folder named secured will be visible to everyone. The program will instantly close as creating new folder won’t take much time.
Now you can copy your secret files and documents in the folder named Secured.
After copying we’ll have to hide it and make it invisible. To do so, we’ll rename secured folder to Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D} and supply the attributes to it. This is the main aim of this script.
ren secured "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s +r +i "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
The above code is nothing but our friendly DOS command. When you execute it, you know what it will do.
Now we’ll have to code something to make it visible again. We can do this by reversing the above script. To remove attributes from the folder “-“ is used instead of “+”. And the Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D} folder will be renamed to secured again.
attrib -i -r -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" secured</code
>
Now the folder it visible and accessible again.
Now you can make this system work with password. Especially the part when user wants to show the folder.
echo put in the key to Unlock the lock
set/p "pass=>password"
if NOT %pass%==123456 goto FAIL
The above block of code will create the input region for password. The second line confirms the password entry. If password is incorrect program will be directed to condition called FAIL. (You must define condition FAIL separately telling what should it do. You can either exit the program or prompt for second chance to input password.). If password is correct then proceeding codes will be executed.
You can see the properly arranged codes below:
cls
@ECHO OFF
title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST secured goto MDLOCKER
:CONFIRM
echo Are you sure u want to Lock the secured(Y/S)
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 secured "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s +r +i "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo secured locked
goto End
:UNLOCK
echo put in the key to Unlock the lock
set/p "pass=>password"
if NOT %pass%==123456 goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" secured
echo secured Unlocked
goto End
:FAIL
echo Invalid keyword
goto UNLOCK
:MDLOCKER
md Secured
echo lock unlocked
goto End
:End
Copy it to notepad and save it in *.bat format.
NOTE: If you are directly copying the above code then be careful with the quotation marks. Replace all the “ and “ quotes to ".
Hope this tutorial was helpful
0 comments:
Post a Comment