Friday 18 October 2013

Protect Flash by DOS/CMD



1. Go to the flash drive, and put everything in one folder titled Flash

2.
On a computer, open up notepad (Start+R and type in 'notepad')
type:
Code:
@echo off
setlocal enabledelayedexpansion
title Password
:START
cls
echo Please Enter password...
echo.
set /p pass=Pass:
if /i '!pass!'=='ENTERYOURPASSWORDHERE' goto next
cls
echo !pass! is not the password. Try again.
pause
goto START
:next
if exist D:/Flash (
set Jbe=D
)
if exist E:/Flash (
set Jbe=E
)
if exist F:/Flash (
set Jbe=F
)
if exist G:/Flash (
set Jbe=G
)
if exist H:/Flash (
set Jbe=H
)
if exist I:/Flash (
set Jbe=I
)
if exist J:/Flash (
set Jbe=J
)
if exist K:/Flash (
set Jbe=K
)
if exist L:/Flash (
set Jbe=L
)
if exist M:/Flash (
set Jbe=M
)
%Jbe%:
start explorer.exe Flash || goto ERROR
exit
:ERROR
cls
echo There was an error opening the file. Would you like
echo to try again???
echo.
set /p jam=Yes or No:
if /i '%jam%'=='yes' goto next
if /i '%jam%'=='no' goto seeya
cls
if not defined jam goto ERROR
echo %jam% is an invalid option. Try again.
pause
goto ERROR
:seeya
Cls
echo Well, see ya!
ping -n 2 127.0.0.1>nul
exit





Once you've copied and pasted that into notepad, save as Password.bat in your flash drive (don't put it under any folders)

Then, you go START+R and type in CMD.

Then, type in (THe drive is the letter with the colon that is assigned to your flash drive EX: J:, E:)

YOURDRIVE:
attrib Flash +s +h

EX:
H:
attrib Flash +s +h

Now, you need to put in the password to open your files. I know it's a long process, but you'll appreciate this in the long run. I use this for my flash drive, and it works great. If I made an error and it doesn't work, post that.

Where it says YOURPASSWORDHERE, delete that and type in your password you wish to use to open your flash drive.
Source(s):
Batch files. They're awesome.

0 comments :

Post a Comment

We Serve All for Free!