Solved

Issuing a DOS command from within my Perl program

Posted on 1998-09-25
4
152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expect & sshpass package for Solaris 10 x86 15 1,028
Perl Script - Remove row of data based on column value 3 77
crawling gofundme 4 151
Excel to CSV conversion with specific columns 5 109
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…
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…

732 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