path as related to the "exec" function

P

pauls

Hi,
I am trying to start another program from within PERL useing "exec"

The problem arises due to, I think, a space in a pathname as follows:

exec("d:\\programfiles\\fred\\program v10.1\\wefit.exe plot.dat");

I am trying to start the program "wefir" on the file "plot.dat"

You'll notice how part of the path to the executable includes a space in
one of the directory names.

If the "wefit" file is located in a directory without a space in the
directory name the above type of code of works fine. But, I am stuck
with the space in the pathname (for now) and need a work around.

Anyone have any helpful thoughts on this?

Thanks!

Paul
 
G

Gunnar Hjalmarsson

pauls said:
I am trying to start another program from within PERL useing "exec"

The problem arises due to, I think, a space in a pathname as follows:

exec("d:\\programfiles\\fred\\program v10.1\\wefit.exe plot.dat");

Quote the path:

exec('"d:\programfiles\fred\program v10.1\wefit.exe" plot.dat');
 
P

pauls

Gunnar said:
Quote the path:

exec('"d:\programfiles\fred\program v10.1\wefit.exe" plot.dat');
Hello Gunnar,
That did the trick. Thank you very much for your help, I appreciate it!

Paul
 
T

Tad McClellan

Gunnar Hjalmarsson said:
Quote the path:

exec('"d:\programfiles\fred\program v10.1\wefit.exe" plot.dat');


Or avoid the shell altogether:

exec('d:/programfiles/fred/program v10.1/wefit.exe', 'plot.dat');
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top