Parameters with Space Character

Hello,

i want to call a .EXE from PERL with parameters.
The Problem is, the .EXE-path and the parameters contain spaces (" ").

I've tried the following

--------------------------------------
system (""D:\Borland C++ 5\start.exe" "A B C" "Bye"");
---------------------------------------

It doesn't work. The .EXE-file exists but i get a 'file not found'-error.

Please help me. My boss is killing me!!!!!!
Thanks
flo

Comments

  • space is a special char - you have to add a before it

    try something like this:

    "hello I'm joe"

    if it does not work still, try just the spaces:

    "hello I'm joe"

    best regards,

    sebastian mohrenstecher
    executive secretary
    net::allies

    www.net-allies.de
    info@net-allies.de

  • : Hello,
    :
    : i want to call a .EXE from PERL with parameters.
    : The Problem is, the .EXE-path and the parameters contain spaces (" ").
    :
    : I've tried the following
    :
    : --------------------------------------
    : system (""D:\Borland C++ 5\start.exe" "A B C" "Bye"");
    : ---------------------------------------
    :
    : It doesn't work. The .EXE-file exists but i get a 'file not found'-error.
    :
    : Please help me. My boss is killing me!!!!!!
    : Thanks
    : flo
    :
    :

    You may have too many "'s! Does this work?

    system ("D:\Borland C++ 5\start.exe "A B C" "Bye"");

    I think you don't need to enclose the filename in "'s as well as the parameters!

    Jonathan




    -------------------------------------------
    Count downloads from your site for free!
    http://www.downloadcounter.com/
    Oh yeah, I run a web hosting thing now too.
    http://www.incrahost.com/

  • It still dont works.

    I get " 'd:Borland' not found".
    With or without " and " ".

    I almost guess it's impossible.

    Thanks
    flo


    :
    : You may have too many "'s! Does this work?
    :
    : system ("D:\Borland C++ 5\start.exe "A B C" "Bye"");
    :
    : I think you don't need to enclose the filename in "'s as well as the parameters!
    :
    : Jonathan
    :
    :
    :
    :
    : -------------------------------------------
    : Count downloads from your site for free!
    : http://www.downloadcounter.com/
    : Oh yeah, I run a web hosting thing now too.
    : http://www.incrahost.com/
    :
    :


  • It works!!!!

    Thanks!!

    flo
  • Hi,

    LOL...so there's one message saying it don't work and one saying it does! LOL! If it still doesn't, then it may be because you're passing to the DOS prompt a long filename. Trying passing the short path/filename and it should work. E.G.

    D:Borland C++ 5

    May become:-

    D:Borlan~1

    Or it may become something else unfortunately... But look at short vs. long paths and filenames...

    If only we'd just got Linux and UNIX... ;-)

    Jonathan


    -------------------------------------------
    Count your downloads:
    http://www.downloadcounter.com/
    And host your site:
    http://www.incrahost.com/
    Don't say I never give you anything... ;-)

  • Hi Jonathan,

    first i've tried to surround the filename and the parameters in double-quotes. This doesn't work because the filename was broken at the spaces (despite quotes).

    Then I only surrounded the filename with double-quotes and add the parameter without double-quotes.

    This works. But I need to seperate the parameters in the system-call by another char, to split them in my c++-program.

    Thanks for help

    IT WORKS!

    flo
  • [b][red]This message was edited by fzapper at 2002-9-7 15:34:11[/red][/b][hr]
    : Hello,
    :
    : i want to call a .EXE from PERL with parameters.
    : The Problem is, the .EXE-path and the parameters contain spaces (" ").
    :
    : I've tried the following
    :
    : --------------------------------------
    : system (""D:\Borland C++ 5\start.exe" "A B C" "Bye"");
    : ---------------------------------------
    :

    Why not just use single quotes and avoid the backslash blues? I tested the following on my system and it works:(Everything inside single quotes is purely literal):

    system('dir "c:program files"');




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories