satyamunni has asked for the wisdom of the Perl Monks concerning the following question:

I have a scenario where, I have generated a perl script and I what to excute from a parent folder whose child has a space in its name.

Ex:

C:\Satya\903\Windows>Dir

Directory of C:\Satya\903\Windows

06/12/2011 15:59 <DIR> .

06/12/2011 15:59 <DIR> ..

06/12/2011 15:20 <DIR> fish food

0 File(s) 0 bytes

3 Dir(s) 433,473,777,664 bytes free

Now I have an Excutable(Genrated from perl) in folder "fish food" and I want to execute it from this location. some think like below

C:\Satya\903\Windows>"fish food\opx_CMB_GEN_903.exe"

Can't open fish: No such file or directory at -e line 1.

Can't open food\opx_CMB_GEN_903.exe: No such file or directory at -e line 1.

Can't open fish: No such file or directory at -e line 1.

Can't open food\opx_CMB_GEN_903.exe: No such file or directory at -e line 1.

Can't open fish: No such file or directory at -e line 1.

Can't open food\opx_CMB_GEN_903.pl: No such file or directory at -e line 1.

not found

I getting above error, Please help me how to deal with this.

Replies are listed 'Best First'.
Re: Space in Folder Name
by marto (Cardinal) on Dec 06, 2011 at 16:11 UTC

    Welcome to the monastery. Please read and understand How do I post a question effectively? and the post formatting guidelines which are displayed when you post. Please show us your code (or a cut down/minimal example) which produces this error and describe how you created the executable.

Re: Space in Folder Name
by JavaFan (Canon) on Dec 06, 2011 at 21:57 UTC
    This seems to be a Windows issue to me. Just the fact that the program you want to execute was created by a Perl program, doesn't make your problem a Perl problem.

    If you follow your logic, you ought to say "Perl is written in C, so I should ask on a C forum".

Re: Space in Folder Name
by keszler (Priest) on Dec 06, 2011 at 17:09 UTC

    at -e line 1 doesn't look to me like a Windows message. Is the generated-from-perl executable trying to do something with $0?

Re: Space in Folder Name
by TJPride (Pilgrim) on Dec 06, 2011 at 16:28 UTC
    If you're quoting it, I don't know why it wouldn't run. Have you tried run "fish food\opx_CMB_GEN_903.exe" or maybe setting up a .bat that does:

    cd "fish food" opx_CMB_GEN_903.exe

    Sadly, I'm on my Mac at the moment, so I can't test scenarios.

      Hi, Thank you very much for the reply, Sadly I cam to know that, we have our own script to create an executable script from perl script. Probably I need to investigate that code. Thank you, Satya