get_iplayer - Query. Set a variable in batch to --subdir

Terence fentango at googlemail.com
Sun Jul 21 15:34:01 EDT 2013


On Sun, 2013-07-21 at 17:02 +0100, Terence wrote:

> I use a rough batch file I wrote to pass commands to get-iplayer. I'm
> wanting to capture the --subdir part & set it to a variable.
> I can then use it to move the programs download folder when complete.
> I'm a novice at batch & use no other programming language.
> Windows 7 x86
> Example: C: & cd "\Program Files\get_iplayer\" &
> "%Windir%\system32\cmd.exe" /c get_iplayer --type=tv "987" --get
> --vmode=best --output="\downloads\media\" --subdir
> set FPLACE=--subdir
> I know that would just set FPLACE to --subdir which is no good. I want
> FPLACE to be set to what --subdir represents.
>
If --subdir does what I think, makes a directory named the same as the
programme, then this should set FPLACE to be the name of the most
recently modified directory in the current directory.

for /f "tokens=1 delims=" %a in ('"dir /b /a:d /o:d"') do @set FPLACE="%
a"

(Above should all be on one line)

If you've not looked, for /? and dir /? can be helpful. I always found
ss64.com a useful resource when I was using batch a lot, I think I read
about the above trick on there.

Nick

Thank you. I will try this & post again in the next few days.
Even with SS64 & the other sources programming leaves me somewhat perplexed.

Terry





More information about the get_iplayer mailing list