How to pull email address and password from text file with CMD?
Solution 1:
Try this loop with find conditioned by delimiters and tokens...
@echo off && setlocal enabledelayedexpansion
set "_log=.\mail.txt" && cmd /v /c cd.>!_log!
for /f "tokens=* delims=" %%i in ('type .\file.txt')do echo/%%~i|find "@" >nul && (
for /f "tokens=1-3 delims=:" %%I in ('echo/%%~i')do echo/%%~I|find "@" >nul && (
set "_m_p=%%~I:%%~J")||set "_m_p=%%~J:%%~K")&& for %%E in ("%%~J")do >>!_log! (
echo/!_m_p: =!|find "@")
- Update - Version inspired by the
@somebadhat's
answer post
@rem.^
Combo: [email protected]:password^
As Combo:^
[email protected]:ajfbdf^
some text here^
some more text here^
As Combo: [email protected]:password@1^
some random text here^
[email protected]:passypassyword123^
[email protected]:youtube123
@echo off & type nul >.\mail.txt & for /f "tokens=*delims=" %%i in ('type file.txt')do (
echo=%%~i|find "@">nul && for /f "tokens=01,02,03delims=:" %%I in ('call echo=%%~i')do (
echo=%%~I|find "@">nul && set "_m_p=%%I:%%J" || set "_m_p=%%~J:%%~K") && for /f %%E in ('
echo=%%~J')do cmd /v/c "echo=!_m_p: =!"|find "@")>>.\mail.txt ||>nul call nul 2>nul 2>&1
Solution 2:
There is not much new here. This is how I would have written It Wasn't Me's answer.
@REM Win10 64-bit Pull email address:password from text file using CMD:
@REM Combo: [email protected]:password
@REM some text here
@REM As Combo: [email protected]:password@1
@REM [email protected]:youtube123
@echo off
cd.> mail.txt
for /f "tokens=* delims=" %%i in ('type file.txt') do echo %%~i | find "@" >nul && (
for /f "tokens=1-3 delims=:" %%I in ('echo %%~i') do echo %%~I | find "@" >nul && (
set "_m_p=%%I:%%J") || set "_m_p=%%J:%%K") && (
setlocal enableDelayedExpansion
for %%E in ("%%J") do echo !_m_p: =! | find "@">> mail.txt
)
exit /b
Or:
@echo off & cd.> mail.txt & for /f "tokens=*delims=" %%i in ('type file.txt')do (
echo %%~i|find "@">nul && for /f "tokens=1-3delims=:" %%I in ('echo %%~i')do (
echo %%~I|find "@">nul && set "_m_p=%%I:%%J" || set "_m_p=%%~J:%%~K") && for /f %%E in ('
echo %%~J')do cmd /v/c echo !_m_p: =!|find "@")>> mail.txt