-

2011年8月4日星期四

I wrote a code for something in CMD and i want to put a password in it how do i do it?

-i want to make it so if the password is incorrect it will exit but if the password is correct then it will go to whatever is in the :correct section



the code so far is:



@echo off

color 0c

title hi

echo please enter password

set /p input=

if %input%=={here is where the password will go} goto correct

if %input%=={i guess anything but the password would go here} goto incorrect

:correct

cls

title correct

echo hello

pause

:incorrect

cls

title incorrect

echo bye

pause

exitYou could use "IF NOT", but all you really need is one IF statement.But couldn't anyone just open up your .bat file, rem out the test for a password and get around it?

Security by 'my users are too stupid to figure this out' never really works.

没有评论:

发表评论