Link to home
Start Free TrialLog in
Avatar of jvieira
jvieira

asked on

Running a program in WinNT

Hello,

I have perl installed on WinBT 4.0.  I am trying to setup a perl script that will execute a VB executable and than sleep for x amount of time and repeat.  I have everything set except for the part of executing the vb program.  Does anyone remember how to get perl to run a program.  I know it was something simple I just can't remember, I thought it was 'system()' but I was wrong.

Thanks,

Joe
Avatar of maneshr
maneshr

use back ticks. i tried that and it worked on NT4.0

Eg.

$v=`dir`;

print $v,"\n";
Avatar of jvieira

ASKER

This is what I have:

$status = 1;
while ($status) {
      $v = `D:\Stuff\Project1\Project1.exe`;
      print $v,"\n";
      sleep 10;
}

minus the parts that change the value of $status.  I get the following error:

The name specified is not recognized as an internal or external command, operable program or batch file

What am I missing?

Thanks,

Joe
ASKER CERTIFIED SOLUTION
Avatar of maneshr
maneshr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I beleive the problem with the application not being recognized is that you were using the windows "\" in your file name, which Perl tries to interpret at meta sequences.

Try the following:

$status = 1;
while ($status)
{
   system("D:/Stuff/Project1/Project1.exe");
   sleep 10;
}

or, if you need the return value from the application:

$status = 1;
while ($status)
{
   $retVal=`D:/Stuff/Project1/Project1.exe`;
   print "$retval\n";
   sleep 10;
}

Whitty
Avatar of jvieira

ASKER

Whitty,

maneshr answered the question first.

Joe
Avatar of jvieira

ASKER

I'm always making stupid mistakes like that.

Thanks,

Joe
i guess at some point of time, we all make stupid mistakes.

glad to be of help :-)