Solved

Issuing a DOS command from within my Perl program

Posted on 1998-09-25
4
151 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…

820 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