batch file problems need help

January 7, 2010 at 16:09:40
Specs: Windows 7
ok I have been trying to find the right code for this but no luck so far so basically what i am trying to do is make a password confirmer so the basic idea is to put a few characters in a txt file and then rename it to the type .key then the program is sposed to change it to a txt file, read it and store the text in the file to a variable then it checks to make sure its correct with a stored variable that you put in. the one problem i am having is setting a variable equal to the text in a txt file and then comparing it with another variable HELP PLS im on windows 7 but i would like the program to wrk on windows xp and vista too if possible thanks for the help


here is the code so far...

@echo off
:index
set /p FN=click and drag the .key file to this window:


IF NOT EXIST %FN% Goto error1.


ren %FN% pass.txt
echo %FN% decrypted successfuly
set /p var=<pass.txt
set /p sss=<confirm.txt
echo confirming...
pause

if "%FN%"=="%sss%" goto done
goto done

ELSE
goto error1
pause


goto end


:done
start key.vbs
echo done!
pause

goto end


:error1
echo AN UNKNOWN ERROR HAS OCCARD
pause
goto index


:end


See More: batch file problems need help

Report •


#1
January 7, 2010 at 16:56:28
It looks like you're comparing the wrong items, but i'm not sure because i don't know how the drag/drop thingey works.
to me, it looks like you should be comparing sss to var, like
set /p var=<pass.txt
set /p sss=<confirm.txt

if "%var%"=="%sss%" goto done


Report •

#2
January 7, 2010 at 17:24:19
ya I just found the code i needed here is the result and it lets you test many files that were renamed from .txt to whatever and checks the known serials it works very well

here is the code you will have to make a txt file with a key you want and a .vbs file named "key" to not get any errors (in the key.vbs i just put "Key file confirmed" so u can use what ever you want thanks again for the help and here is the code...

@echo off
set /p FN=click and drag the .key file to this window:


IF NOT EXIST %FN% Goto error1.


ren %FN% %FN%.txt
echo %FN% decrypted successfuly
fc %FN% key1.txt > nul
if errorlevel 1 goto key2
echo confirming...
goto done

:key2
fc %FN% key2.txt > nul
if errorlevel 1 goto key3
goto done


:key3
fc %FN% key3.txt > nul
if errorlevel 1 goto error1
goto done

:done
start key.vbs
echo done!
pause

goto end


:error1
echo THIS KEY FILE IS INCORRECT
pause
goto index


:end


Report •

Related Solutions


Ask Question