Solved

Issuing a DOS command from within my Perl program

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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 …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

759 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

24 Experts available now in Live!

Get 1:1 Help Now