I've been working on this batch script with which i want to copy random files from one folder to another and every thing is fine but i can't copy a file if there is space in it's name and i can't put a variable after delims what should i do help
this is my code
@echo off
:1
set num=0
cls
set /p input=enter the number of total files:
set /p input1= enter the number of files you want:
set /p address= enter the address of your files:
FOR /f "tokens=1*delims=:" %%b IN ('dir /b /a-d "%address%\*" ^|findstr /n /V ":"') DO ECHO.%%b: %%c>> filename.txt
md SelectedFiles
:2
set /a l= 1+1
set /a num=%num%+1
set /a n=%random% %% %input% +1
for /f "tokens=1* delims='%n%:'" %%a in (filename.txt) do if 2==%l% set file=%%b
timeout 1
echo %n% %file%
copy %file% SelectedFiles
if %num% lss %input1% goto 2
echo your files have been copied
pause
goto 1