what I need is if the password found save it to text file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
roro4465
Posts: 2
Joined: 06 Sep 2011 20:50

what I need is if the password found save it to text file

#1 Post by roro4465 » 06 Sep 2011 20:52

I have this code (CMD bat file)


@echo
text -u text -w numeric1.txt

this code is for testing passwords

usually if it is find the password I get this 2 lines (I type it exactly)
[+] Password : [X]
[+] Status : Rasta!

X is the password that it is found

what I need is if the password found save it to text file ; and if the password not found then just close the bat file (the default thing happen is close when end if it find the password or not so I need code to change the default )

Can you please help me with that ?

Regards

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: what I need is if the password found save it to text fil

#2 Post by nitt » 06 Sep 2011 21:02

Your question confuses me. Please use proper grammar and restate a simple version of your question.

For writing files, you need to use Senders (not a technical term). Watch a summary of that here.

If you are trying to read a file and search for a specific line of text, you may want to look into the FOR loop, which my tutorial for that hasn't uploaded yet, but if you view the previous threads you can find some textual tutorials I have written out.

roro4465
Posts: 2
Joined: 06 Sep 2011 20:50

Re: what I need is if the password found save it to text fil

#3 Post by roro4465 » 06 Sep 2011 21:11

Hi again;
simple version of my question

I need code if the result of my bat file is "[+] Status : Rasta!" then it will save the line above it "[+] Password : [X]"
X is the password

Can you help me with that ?

Regards

nitt
Posts: 218
Joined: 22 Apr 2011 02:43

Re: what I need is if the password found save it to text fil

#4 Post by nitt » 06 Sep 2011 21:25

roro4465 wrote:Hi again;
simple version of my question

I need code if the result of my bat file is "[+] Status : Rasta!" then it will save the line above it "[+] Password : [X]"
X is the password

Can you help me with that ?

Regards


I have no clue what a "[+] Status : Rasta!" is. But if you are asking to compare strings, that's like

Code: Select all

if "%string1%" EQU "%string2%" (
dosomething
)


That's conditionals.

Maybe it's because I'm deadly tired, but I still don't really understand your question. I hear:

Code: Select all

If "%results%" EQU "[+] Status : Rasta!" (
echo %password% > test.txt
)


Or something like that...

Post Reply