setlocal
set "s=DIR D:\MyFolder /S /Q ^|FIND /i "Owner" ^|FIND /v /i "sample" ^|findstr /m /i "\.mkv$""
for /f "Tokens=5,6*" %%a in ('%s%') do >>%tmp%\list.txt echo %%a %%b %%c
wscript "C:\my.vbs"
Hey guys, I have this code. Getting mkv files owned by Owner from MyFolder. And shows them via VBS.
And these are my files.
The.Leftovers.S01E02.720p.BLABLABLA
Falling.Skies.S04E03.720p.BLABLABLA
I want to limit the length to 20 letters. Or remove before the 720p
The.Leftovers.S01E02
Falling.Skies.S04E03
I read some guides but I couldn't import them into for /f "Tokens. Is it possible to do that? If so how?
Here is a batch file which will list the contents of the current directory, trimming all the names to 20 characters.
SETLOCAL ENABLEDELAYEDEXPANSION
@echo off
for %%f in (*) do (
set TMPF=%%f
echo !TMPF:~0,20!
)
For more help, run SET /?
for help about the ~0,20 syntax and examples, and CMD /?
for what the ENABLEDELAYEDEXPANSION does and what the !!
does.
I can't for sure say how this would fit in your code, but maybe something like:
SETLOCAL ENABLEDELAYEDEXPANSION
for /f "Tokens=5,6*" %%a in ('%s%') do (
set TMPA=%%a
>>%tmp%\list.txt echo !TMPA:~0,20! %%b %%c
)