Solved

Running a program in WinNT

Posted on 2000-02-17
7
144 Views
Last Modified: 2012-05-04
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
Comment
Question by:jvieira
  • 3
  • 3
7 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 2532554
use back ticks. i tried that and it worked on NT4.0

Eg.

$v=`dir`;

print $v,"\n";
0
 

Author Comment

by:jvieira
ID: 2532695
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
 
LVL 16

Accepted Solution

by:
maneshr earned 50 total points
ID: 2532840
i just changed my script to this and it works

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


replace the \ with /
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:Whitty
ID: 2532893
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
 

Author Comment

by:jvieira
ID: 2536120
Whitty,

maneshr answered the question first.

Joe
0
 

Author Comment

by:jvieira
ID: 2536121
I'm always making stupid mistakes like that.

Thanks,

Joe
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2536156
i guess at some point of time, we all make stupid mistakes.

glad to be of help :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now