Question Trying to set a text file's contents as a %var% then using that as youtube-dl %var%

modemproblem101

Reputable
Jun 3, 2019
19
0
4,510
the title says what i'm trying to do, but the code is not working for some reason, why?
Code:
@echo off
cd /d D:\123\p\youtube-dl\
start "" link.txt
:loop
timeout /t 1
type link.txt | findstr /i /c:"youtube"
if %errorlevel%==0 (set /p link=<link.txt
youtube-dl %link%
echo empty > link.txt
taskkill /im notepad++.exe /f
exit)
goto loop
 

modemproblem101

Reputable
Jun 3, 2019
19
0
4,510
nvm solved, the code was so messed up. this works:
Code:
@echo off
cd /d D:\123\p\youtube-dl\
start "" link.txt
:loop
timeout /t 2
type link.txt | findstr /i /c:"empty"
if %errorlevel%==0 goto loop
set /p link=<link.txt
youtube-dl %link%
echo empty > link.txt
taskkill /im notepad++.exe /f
exit