Help with --command syntax

dinkypumpkin dinkypumpkin at gmail.com
Thu Oct 23 11:47:46 PDT 2014


On 23/10/2014 17:38, Vangelis forthnet wrote:
> On Thu Oct 23 00:29:15 BST 2014, dinkypumpkin wrote:
>> --command "cmd /c cd /d F:\Downloads\FLVtoMP4remux ^&^& remux.bat"
>
> Many thanks for this, that works up to a point due to limitations of
> remux.bat
> described above; works PERFECTLY with remux1.bat !!!
> The final --command option I used was:
>
> -c "cmd /c cd /d F:\Downloads\FLVtoMP4remux ^&^& start cmd /c remux.bat"

As you've discovered, you need START if you're going to interact with 
the invoked batch file since it gives you a new window.

>> If your path has white space:
>>
>> --command "cmd /c cd /d """F:\Downloads\FLV to MP4remux""" ^&^&
>> remux.bat"
>
> Thanks; dare I be greedy and ask you what the command would be if my
> batch's
> filename also contained white space (e.g. "video remux.bat")?

The same thing - wrapped in triple quotes.  Just be sure not to leave 
spaces between the ends of the path and the quotes.

> Noted and researched further (http://ss64.com/nt/cmd.html)
>
>> You need to escape each ampersand
>
> But why are there 2 "&" in the working command you posted?

Double ampersand is a conditional execution operator.  It doesn't really 
matter here, but it keeps remux.bat from launching if CD fails.  Single 
ampersand is just a separator. In your earlier example, you would always 
want EXIT to run no matter what happened with preceding command, thus a 
single ampersand

> I guess the value of the -c option needs to conform to perl conventions;
> I am not proficient in batch or MS-DOS language, so I usually search
> for working scripts on the net... stackoverflow.com has many templates;
> but it is difficult to find a guide on how to translate a script that
> works in
> the Windows command line to a version accepted by GiP's -c option...

The above should cover most things you need to do with --command on 
Windows.  The best thing is to create a single batch file that does 
everything you need, put it in a path without spaces and invoke it from 
--command with its full path via CMD /C That way you don't have to deal 
with any quoting or escaping or changing directory.  Add START if it 
requires user interaction, and use START /WAIT if it should run 
synchronously.




More information about the get_iplayer mailing list