Cannot get system (or backtick) fucntion to w

piyush_mehta wrote on Tue Jul  1 05:19:22 MEST 2008:

I have a Cygwin Perl (v 5.8.8) installation with EPIC 0.5.X

Perl script executiuon is fine - until I attempted to invoke a system call

	system( "sc", "stop", "Tomcat5" );

	if ( $? == -1 ) {
		print "command failed: $!\n";
	else {
		print "command exited with value %d", $?;

I get the error:
command failed: No such file or directory

Replacing "sc" above with "ls", "dir" eevn "" results in the same error

Any suggestions as to a solution :-) or how I may go about trobleshooting
it? (Not a perl expert)

When running the script from a Cygwin Bash Shell, the script does execute
as you would expect it to.

Thanks for any pointers.
jploski wrote on Tue Jul  1 13:46:41 MEST 2008:
Try setting the PATH environment variable on the Environment tab of the
launch configuration.
piyush_mehta wrote on Tue Jul  1 20:27:33 MEST 2008:
Thanks. That was it.

As instructed, I added the PATH variable and gave it the value /cygdrive/c/cygwin/bin/
(specific to my environment) and it works now. 

Also, without the above change, clicking on the Select... button and selecting
to add the Path environment variable also works. My Path environment variable
included the path to the cygwin bin (not as typed above) but simply as c:\cygwin\bin

Thanks again.

Note: The above is an archived snapshot of a forum thread. Use the original thread at to post comments.