Howdy, Stranger!

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

Categories

Parameters with Space Character

flomiflomi Member Posts: 15
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

  • SouldrinkerSouldrinker Member Posts: 143
    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

  • JonathanJonathan Member Posts: 2,914
    : 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/

  • flomiflomi Member Posts: 15
    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/
    :
    :

  • flomiflomi Member Posts: 15

    It works!!!!

    Thanks!!

    flo
  • JonathanJonathan Member Posts: 2,914
    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... ;-)

  • flomiflomi Member Posts: 15
    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
  • fzapperfzapper Member Posts: 7
    [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"');




  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    ____ ( http://forcoder.org ) free ebooks and video tutorials about // MATLAB PHP Delphi Assembly Scratch Visual Basic .NET Objective-C C C# JavaScript Python C++ Swift Visual Basic Go Ruby Perl R Java PL/SQL Transact-SQL Dart Erlang D LabVIEW Prolog COBOL Julia Lisp Apex SAS Scheme Crystal Fortran Lua Kotlin ML F# Ada FoxPro Scala Awk VBScript ABAP Hack Clojure Alice Rust Bash Logo // ___________

Sign In or Register to comment.