Hi guys,

I would like to execute something like this in my program:
system("C:\test\perl\a.pl");

But the problem is i need to execute: perl a.pl
Can't just execute the a.pl and expect it to run. Any ideas on how i could simply open up the cmd prompt with my program and cd into the appropriate folder, and then enter: perl a.pl

Thanks for your help.

Recommended Answers

All 4 Replies

What is wrong with

system("perl C:\test\perl\a.pl");

?

if the cmd runs it as: a.pl nothing happens
it needs to be ran as: perl a.pl

i just made a batch file. easy fix.

Right, I stuck a "perl" in front of the file name inside the system() call.

A batch file would also work (cd to the directory you want and then "perl file.pl"), but it doesn't seem necessary here.

Dave

Right, I stuck a "perl" in front of the file name inside the system() call.

A batch file would also work (cd to the directory you want and then "perl file.pl"), but it doesn't seem necessary here.

Dave

oops. missed your correction. thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.