I am writing a simple batch file that copies a video from a web server using a user submitted url. I would like to extract parts of the user submitted string and set them as a variables. Below is my example code.
@echo OFF
SET outputdir= %~dp0output\
SET libav= %~dp0libav\win64\usr\bin
CD %libav%
SET /p code= "Paste the download code from your browser: "
The user will be inputting a string that is in this exact format for %code%:
avconv -i "http://example.com/i/index_0_av.m3u8" -codec copy -qscale 0 video_name.mp4
I want to use a space as the delimiter. I need to set the 3rd item as %url% and 8th item as %filename%. Basically I am trying to do what explode() does in PHP.
The goal is to run the following as the final line in the file.
call avconv -i "%url%" -codec copy -qscale 0 %outputdir%%filename%
avconv -i "http://example.com/i/index_0_av.m3u8" -c copy -qscale 0 "video_name.ts"-c copyyou do not need-qscale.