简体   繁体   中英

Weird Windows 10 batch compatability issue

I just upgraded Windows 10. But the batch file I wrote not works completely. Same coding was working with Windows 7. That's the piece of code.

:BASLA
SETLOCAL ENABLEDELAYEDEXPANSION

set "s=DIR D:\Diziler /S /Q ^|FIND /i "Administrators" ^|findstr /m /i "HDTV" ^|findstr /m /i "\.mkv$""
for /f "Tokens=5,6*" %%f in ('%s%') do (
    set FULLNAME=%%f
    set ENDTEXT=!FULLNAME:*0p=!
    call set TRIMMEDNAME=%%FULLNAME:!ENDTEXT!=%%

for /r D:\Diziler\ %%g in (*) do echo %%~nxg >> %tmp%\altyazi.txt 

>nul findstr /c:"!FULLNAME:~0,-4!.srt" %tmp%\altyazi.txt  && (
>>%tmp%\list.txt echo !TRIMMEDNAME!*
) || (
>>%tmp%\list.txt echo !TRIMMEDNAME!
)
)
)

First part is working as usual. altyazi.txt gives the right output. But when it comes the list.txt all the outputs are Echo is off. I have never seen something like this. Works with 7 but doesn't work with 10.

Windows 10 and Windows 7 are giving different columns when DIR listing. Changing the tokens would solve the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM