• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

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
0
jvieira
Asked:
jvieira
  • 3
  • 3
1 Solution
 
maneshrCommented:
use back ticks. i tried that and it worked on NT4.0

Eg.

$v=`dir`;

print $v,"\n";
0
 
jvieiraAuthor Commented:
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
0
 
maneshrCommented:
i just changed my script to this and it works

`c:/manesh/perlcd/core/setup.exe`;


replace the \ with /
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
WhittyCommented:
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
0
 
jvieiraAuthor Commented:
Whitty,

maneshr answered the question first.

Joe
0
 
jvieiraAuthor Commented:
I'm always making stupid mistakes like that.

Thanks,

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

glad to be of help :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now