Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with "RUN" and "DOS" comman 1

Status
Not open for further replies.

mikehenderson

Programmer
Dec 20, 2000
10
0
0
CA
Problem with "RUN" and "DOS" command and printer escpae sequences.

I am a recent new user of Visual dBase 5.5 having used dBase 5 for DOS before this. I am running on Windows NT ver 4.0. I can't get the RUN and DOS commands to work.

When I type "DOS" a new dbase command window pops up and the "DOS" command echos:
DO /c WITH "C:\WINNT\system32\cmd.exe"
and an error statemet appears:
ERROR FILE DOES NOT EXIST C.PRG

With the "RUN DIR" command the same thing happens. This time the command is expaned to:
DO /C WITH "DIR"
and the error message is the same as above.
It seems that my commands are being parsed and expanded inappropriately. I installed the Visual dBase 5.5 on a Windows 98 box and the commands RUN and DIR worked fine.
Any suggestions?

Also I can't send escape sequences to my printerts to control them. I can only use the STYLE with ? to printer and _ppitch commands to contol fonts. I want to be able to send escape sequences like I did with dBase 5 for DOS so that I will not have to rewrite my old code and so I can have greater printer control. I have tried to use the generic Text driver but it still traps the escape sequences. Any suggestions?
Thanks.

 

Hello mike

I am using dbase 7. You just have to choose the command window option thro
View menu and got to give the command run dir at the prompt. It is also
the same way with the dos command. It works. I am using windows nt 4.1.
Can U try once again. Here you can make the printer settings thro the
printer dialog box which I think is much more adaptable and user friendly.

Regards

anitas

 
Hi Anitas,

I am already doing what you said. I am in the command window and I type run dir or dos at the prompt.

The command expands to:

DO /c WITH "C:\WINNT\system32\cmd.exe". I had given up on visual db till your response. something has happended. now it just starts spawning more dbase jobs and I have to shut it off with ESC and task manager when I type the command DOS or Run Dir.

and an error statemet appears as described in my original question. I emphacize that it works fine for me in windows 98. Any other suggestions?
Mike

 
I experience exactly the same problem. It works fine in Windows 98, but nog in Win NT workstation.... using RUN() doesn't help....

 
I just joined this forum, and I know your query started almost 2 years ago, but I thought I'd record my experience anyway.

I was running OS2/2.1 until this year and changed to Win2000, dBase 5 for DOS worked fine under both.

I am now using Vdb5.5 after years of dB5.
When I first installed Vdb, I kept a session of dB5 around, just in case.

Most of Vdb works ok, the significant exception for me as well, being the RUN command and Printer escape sequences. When I issue a RUN command or a Printer command from within a procedure or at the command line I get an error that file C.PRG does not exist. Same error every time.

I'm looking to fix it of course, but for the time being I'm keeping that dB5 session open for those procedures which contain ESC sequences and RUN commands. Not pretty, but it's keeping me afloat.

mac57
 
The /c and the rest of the command is generated by dbase in response to the run and dir commands. It is not something that we can leave out since all that our programs are doing is issuinf dos commands preceeded by the run command. that worked fine up until dbase 5.5.
If you go to the top of this thread you will see what i am talking about.
Thanks
 
hello cfneumann
Thank you for your suggestion.

I installed version5.7 as you recommended.
No change to my problem. It still does this:

When I type "DOS" in the command window a new dbase command window pops up and the "DOS" command echos:
DO /c WITH "C:\WINNT\system32\cmd.exe"
and an error statemet appears:
ERROR FILE DOES NOT EXIST C.PRG

With the "RUN DIR" command the same thing happens. This time the command is expaned to:
DO /C WITH "DIR"
and the error message is the same as above. All other dos commands preceeded by the run command do the same thing yet work fine on windows 98.

How do you from within a program or from the command line invoke dos commands in Windows NT without this happening?
I am using NT v4.0 by the way.
MH
 
I just installed VdB 5.7 on a NT4SP3 (has never seen VdB in its life). File does not exist occurs. Also, it launches another instance of VdB.

Maybe we can find another way. Why do you need a DOS window? Christopher F. Neumann
[dBASE Charter Member]
Blue Star Visual dBASE graduate
ICCP certified TCP/IP Network Analyst
 
I have made some progress with the run command.

if I use the full version of it it works.

eg run(.t.,"dir")

That will print the directory
The .t. tells the program to use a windows command.
If .f. is used instead the same error as above occurs.

I need to use dos so that I can sent full printer commands (escape sequences) to control a printer. I have lots of legacy code that I don't want to rewrite using the report generator. Also, I need to print text files to the printer.
Is there a Dbase command that would be equivalent to:

"print testfile.txt"

or "type testfile.txt > lpt3:"

or "copy testfile.txt lpt3::

If so, I wouldn't have to use DOS.


The only way I have figured out to do it in Dbase would be to import a text file into a memo field or database and use the list command in dBase to print it. I wouldn't be able to use the printer escape sequence commands that way though I don't think.

How can a file be printed in dBase?

Mike H


 
Go to Vic McClung's page and download the 16/32-bit version of the printer/preview class.

This should handle everything you have been trying to do on your printouts. Christopher F. Neumann
[dBASE Charter Member]
Blue Star Visual dBASE graduate
ICCP certified TCP/IP Network Analyst
 
Mike,

I had similar problems with run() but have found a solution

(BTW I'm running Visual dBase 5.7 in Windows 2000)

if I wanted to run a DIR of c: from within dbase:
run(.t.,"c:\winnt\System32\cmd.exe /c dir c:\")

if I wanted to redirect I/O to a text file:
run(.t.,"c:\winnt\System32\cmd.exe /c dir c:\ >txtfile.txt")

I found useful information at the following URL that helped me resolve this.

I hope this helps,
al
 
Excellent tip DBACAN,

I sorted out the infamous "C.PRG not found" by creating a C.PRG in the path with your suggested command.
Now all shell commands run smooth.
Here's the contents of my command file (C.PRG):
**
PARAMETERS param1
RUN (.T., "C:\WINNT\SYSTEM32\CMD.EXE /C " + param1 )
QUIT
**
 
Hello friend
How U?
Pls use '!', the sign is on 1 on keyboard.
Regards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top