Answer the question
In order to leave comments, you need to log in
How to organize the search for words by the number of characters?
Good afternoon!
There are several folders that store txt files containing lists of domains. I wrote a bat file that loops through all files from a specific folder (dest=G:\Domains\BAT\Files\2008\) and searches for keywords in them from a txt file (G:\Domains\BAT\tags.txt) . Found domains are written to a new txt file, which is saved in the folder "G:\Domains\BAT\Results\2008"
echo on
setlocal EnableDelayedExpansion
>nul chcp 1251
set "dest=G:\Domains\BAT\Results\2008\"
set "dir=G:\Domains\BAT\Files\2008"
>nul chcp 866
(FOR /F "tokens=*" %%z in ('dir %dir% /b /a-d') do (
FOR /F "usebackq" %%i IN ("G:\Domains\BAT\tags.txt") do (
set word=%%i
FOR /F "tokens=*" %%a in ('FINDSTR /R /I /C:%%i %dir%\%%z') do (
echo %%a >> %dest%%%i.txt"
)
)
))
)
endlocal
Pause
Answer the question
In order to leave comments, you need to log in
Below is a quick procedure for counting the length of a string. In parameters, pass variable names, not values, i.e. call like this:
call:strlen str len
::original: http://forum.script-coding.com/viewtopic.php?pid=71000#p71000
:strlen StrVar RtnVar -- be sure to check if the returned errorlevel is 0
setlocal
set /a "}=0"
if "%~1" neq "" if defined %~1 (
for %%# in (4096 2048 1024 512 256 128 64 32 16) do (
if "!%~1:~%%#,1!" neq "" set "%~1=!%~1:~%%#!" & set /a "}+=%%#"
)
set "%~1=!%~1!0FEDCBA9876543211" & set /a "}+=0x!%~1:~32,1!!%~1:~16,1!"
)
)
endlocal & set /a "%~2=%}%"
exit /b
for /f "tokens=1 delims=." %%a in ("%doaminname%") do echo.%%a
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question