Help with --command syntax

Vangelis forthnet northmedia1 at the.forthnet.gr
Thu Oct 23 09:38:21 PDT 2014


On Wed Oct 22 20:50:10 BST 2014, I wrote:

> But if I, somehow, tell GiP to run the command
> I originally posted:
>
> cmd /k "cd /d "F:\Downloads\FLVtoMP4remux" & "remux.bat" ^&& exit"
>
> that "cd"s to where both the EXEs & .bat are found,
> I'd expect it should work.

 Just for the history of it, and prior to dp's reply,
my "experiments" continued and I finally ended up
with a rustic but working solution.
I created a new batch file, called "RunExtBat1.bat"

--------------------------------------------
@echo off
REM *** Run External Batch File ***
REM *** CD to where .bat is found  ***
cd /d "F:\Downloads\FLVtoMP4remux"
REM *** Execute .bat ***
CALL "remux.bat"
:END
--------------------------------------------

I have write access to GiP's installation directory,
so for convenience I placed it there.

I then used this GiP command:

get_iplayer --pid=p026knvh --modes flashstd --force --raw --outputtv 
"F:\Downloads\FLVtoMP4remux" -c RunExtBat1.bat

It seemed to have done the job, but:
remux.bat towards the end of its execution
requires user input (plus it contains 3
PAUSE lines); I wasn't able to interact with
the GiP console window, so I had to kill it...
 I then edited the code of remux.bat to not
require user input & removed all PAUSE lines.
Renamed it to remux1.bat  & also edited
RunExtBat1.bat to call remux1.bat ; my
objective was then accomplished.

Upon further checking the net for alternative
solutions, I bumped on the "start" command;
To cut it short, RunExtBat2.bat was created,
similar to RunExtBat1.bat but its penultimate line reads:

start cmd /k CALL "remux.bat" ^& exit

Adding -c RunExtBat2.bat to the GiP command,
opens (the original version of ) remux.bat in a new
command prompt window, which now accepts
my input...

On Thu Oct 23 00:29:15 BST 2014, dinkypumpkin wrote:

> Try this:
>
> --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"

> 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")?

> Just running a batch file does not change your working directory.
> That's why your script didn't find the supporting EXEs

Thanks; I figured it out from the (non-)outcome...

> You needed the exit statement because you were using cmd /k.
> (snip)
> cmd /c terminates after the commands are finished.

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?
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...

Many thanks for taking the time to answer in a period right after a
major release when the list, support forum, Git-Hub issue tracker,
GiA issue tracker e.a. receive increased traffic...

Kind regards,
Vangelis. 




More information about the get_iplayer mailing list