Solved

Issuing a DOS command from within my Perl program

Posted on 1998-09-25
4
149 Views
Last Modified: 2010-03-05
I am using Perl for Win32 Build 316 and seem to have the following problem. Whenever I use the following format to issue a shell command

print `dos command goes here`;

my PC seems to look on the floppy drive (i.e. the light comes on and the drive grinds). The shell command still works (i.e. it doesn't fail through not finding the file), but it is obviously quite annoying. At first I thought it might be some kind of pathing problem, but even when I have reset the path, it still happens.

Any suggestions ?

Thanks


Matt Freake
0
Comment
Question by:paninaro
  • 2
4 Comments
 

Expert Comment

by:bjornh
ID: 1204999
Is a:\ in your search path?

Type: 'set' from a dosbox and look for the path= line
0
 
LVL 2

Expert Comment

by:bertvermeerbergen
ID: 1205000
How did you 'reset' the path ?  The backticks will create a dos environment to run in, and maybe this environment has the floppy drive in the path.  I was using 316 until a few days ago, and I cannot reproduce the problem with it on my PC.
A few things to try:
- check the real environment with: print `set`;
- try using system() instead of backticks.  Although I don't see what this could change, I did get some strange behaviour with running dos commands (mostly concerned with arguments passing)
- put an exe file on a floppy and use: print `this.exe`;    Does it really gets executed, indicating there must be a 'a:' in the PATH used by the environment.

0
 

Author Comment

by:paninaro
ID: 1205001
Curiouser and curiouser. If I use
    print `set`;
A: does not seem to be in the path anywhere (though in carrying out the command, it does of course check the A:drive). Also if I put an exe file on a floppy and use:
    print `this.exe`;
the A: drive whirrs, the light comes on, but the screen says "bad command or file name".

However by using system, rather than the backticks, there the A: drive remains completely silent and the light remains firmly off (and the relevant DOS command works correctly). I'm beginning to wonder if maybe this is some kind of hardware problem.

Anyway, the "system" solution if good enough for me. So, how do I allocate points for this ?
0
 
LVL 2

Accepted Solution

by:
bertvermeerbergen earned 200 total points
ID: 1205002
Since the 'system' works for you, I am posting this answer so you can allocate the points.
A small remark concerning the exe test:  you did put the exe under the name 'this.exe' on the floppy, I suppose ?  I did not state this clearly in my response, and you didn't either in your comment.
Maybe that the backticks are looking for 'a:\command.com', but I have no idea why it would look on the a: drive.
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

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

910 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

22 Experts available now in Live!

Get 1:1 Help Now