Skip to main content
Inspiring
December 22, 2020
Answered

cfexecute question

  • December 22, 2020
  • 4 replies
  • 985 views

I am trying to get cfexecute to work. From a command line within drive d\lame on a Windows server if I run:

lame -b 128 "Abba - Dancing Queen.mp3" "Abba - Dancing Queen 128.mpe"

The file converts as expected.

From CF2016 if I run:

<cfexecute name="d:\lame\lame.exe"
arguments="-b 128 ""Abba - Dancing Queen.mp3"" ""Abba - Dancing Queen 128.mp3"""
outputFile = "D:\lame\output.txt"
>

Nothing happens. Output.txt is blank and the file doesn't convert. Doesn't even seem like lame.exe even executes.

 

Suggestions?  (insert lame song jokes here)

 

Thanks, Gary

    This topic has been closed for replies.
    Correct answer BKBK

    Hi ghanna1

    I followed these steps:

    1. downloaded the 64-bit Lame library from https://www.rarewares.org/mp3-lame-bundle.php and unpacked it to my D drive.
    2. downloaded a test MP3 at https://file-examples.com/index.php/sample-audio-files/sample-mp3-download/, and renamed the file to Abba - Dancing Queen.mp3
    3. ran the following code

     

    <cfexecute name="d:\lame\lame.exe" arguments='-b 128 "d:\lame\Abba - Dancing Queen.mp3" "d:\lame\Abba - Dancing Queen 128.mp3"'></cfexecute>

     

    It works as expected.

     

     

     

     

     

    4 replies

    ghanna1Author
    Inspiring
    December 23, 2020

    Lame.exe only requires quotation marks if there are spaces in the input or output file. For a test, I renamed the input file to queen.mp3 and the output file to queen128.mp3. I ran the command line as:

    lame -b 128 queen.mp3 queen128.mp3

    which worked as expected.

    I tried the same argument without quotes in CF and it works. So it's something wrong in how we're creating the argument with quotation marks. 

    <cfexecute name="d:\lame\lame.exe"
    arguments="-b 128 d:\lame\queen.mp3 d:\lame\queen128.mp3"> 

     

     

    BKBK
    Community Expert
    BKBKCommunity ExpertCorrect answer
    Community Expert
    December 23, 2020

    Hi ghanna1

    I followed these steps:

    1. downloaded the 64-bit Lame library from https://www.rarewares.org/mp3-lame-bundle.php and unpacked it to my D drive.
    2. downloaded a test MP3 at https://file-examples.com/index.php/sample-audio-files/sample-mp3-download/, and renamed the file to Abba - Dancing Queen.mp3
    3. ran the following code

     

    <cfexecute name="d:\lame\lame.exe" arguments='-b 128 "d:\lame\Abba - Dancing Queen.mp3" "d:\lame\Abba - Dancing Queen 128.mp3"'></cfexecute>

     

    It works as expected.

     

     

     

     

     

    ghanna1Author
    Inspiring
    December 23, 2020

    BKBK,

    Thanks for going through all that effort! I really appreciate it. I must have fat-fingered something the first time I tried your example. I also got it to work late last night using: 

    <cfexecute name="d:\lame\lame.exe"
    arguments="-b 128 ""d:\lame\ABBA - Dancing Queen.mp3"" ""d:\lame\Abba - Dancing Queen128.mp3""" />

     

    Appreciate everyone's help!

     

    Gary

    ghanna1Author
    Inspiring
    December 23, 2020

    Thanks for the suggestions. I tried BKBK's:

    <cfexecute name="d:\lame\lame.exe"
     arguments='-b 128 "d:\lame\Abba - Dancing Queen.mp3" 
    "d:\lame\Abba - Dancing Queen 128.mp3"'

    I also tried adding timeout as Charlie suggested.

    <cfexecute name="d:\lame\lame.exe"
    arguments='-b 128 "d:\lame\Abba - Dancing Queen.mp3" 
    "d:\lame\Abba - Dancing Queen 128.mp3"'
    timeout = "20"
    outputFile = "D:\lame\output.txt"> 

    I also tried Charlie's suggestion of running CMD:

    <cfexecute name="c:\windows\system32\cmd.exe" arguments='/c d:\lame\lame.exe -b 128 "Abba - Dancing Queen.mp3" "Abba - Dancing Queen 128.mp3" ' 
    timeout = "20"
    outputFile = "D:\lame\output.txt">

    Still no luck. Even if the arguments are wrong Lame.exe returns something. If CF is launching the exe shouldn't I see something besides an empty output.txt file created? I thought it would capture whatever lame.exe outputted. 

     

    Gary

    BKBK
    Community Expert
    Community Expert
    December 22, 2020
    <cfexecute name="d:\lame\lame.exe"
               arguments='-b 128 "d:\lame\Abba - Dancing Queen.mp3" 
                          "d:\lame\Abba - Dancing Queen 128.mp3"'>
    
    EddieLotter
    Inspiring
    December 22, 2020

    As @BKBK is showing, use fully qualified paths for all files in your arguments.

    One small correction, the destination filename should have an "mpe" extension. I think @ghanna1 made a typo in the CF version of what they're trying to do. The "mpe" was the typo.

    ghanna1Author
    Inspiring
    December 22, 2020

    Actually, it supposed to be .mp3 on both. 

    Charlie Arehart
    Community Expert
    Community Expert
    December 22, 2020
    Well, take it one step at a time.
    1. You have left off a timeout. I think you'll find that's needed, even just timeout=1
    2. What if you leave off the arguments? Do you then get any output?
    3. In your args you have escaped double-quotes. That MAY work, but try also just single quotes for them, or double quotes for them and single quotes for the entire arguments value
    4. Finally, if all else fails, 
    Try:
    <cfexecute name="c:\windows\system32\cmd.exe" arguments="/c d:\lame\lame.exe -b 128 'Abba - Dancing Queen.mp3' 'Abba - Dancing Queen 128.mp3'" outputFile = "D:\lame\output.txt" timeout="10"/>
     
    Let us know how any go, or if none.

    /Charlie (troubleshooter, carehart. org)