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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bat file

Status
Not open for further replies.

juhlar

Technical User
Feb 1, 2012
10
US
I am having trouble passing commands from a .bat file into foxcmd8.exe. I can get foxcmd8 to open but then I get an error - no PARAMETER statement is found.

I just need to know how to get the .bat file to pass the commands to the command line in foxcmd8.

Thanks in advance for the help.
 
What is foxcmd8.exe?

If it's a custom program, you need to include a PARAMETERS statement as the first executable line of code in the main prg.
 
to add to dans explaination:
Parameters are having two sides: Caller (bat file= sends parameters, Callee (foxcmd8.exe) does receive parameters. You receive parameters with a PARAMETERS statement as the first line, in this case the first line of the main component of foxcmd8.exe.

If you get that error foxcmd8.exe does not receive parameters, if it's not your exe you can't add that feature, this exe just won't accept any input as parameters.

Bye, Olaf.
 
Dan, Olaf, I suspect FoxCmd8 is one of those compiled command window utilities, like FoxBox and vRunFox.

Juhlar, if that's so, then you should check the documentation (if any) that came with the product. There might be some other ways of achieving your goal (other than passing parameters from a batch file).

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
ok, maybe it would be easier to ask how to get a batch file to pass commands to the command line of visual foxpro 9.
 
Again asked, what are you talking about?

The full version of foxpro has a command window, but you don't call that via batch to execute something, you launch foxpro, create a project, build an exe and deploy that. And you can decide to support command line parameters.

The full foxpro 9 has a main exe called vfp9.exe and this is the VFP IDE, not allowed for redistrubution. As you have foxcmd8.exe this does not seem to be a full vfp version, but some command window or command line tool done with VFP8. It is not foxpro itself, but as Mike assumes may be one of those command window/ command line implenmentations done to be able to execute some commands at a customer without using the full vfp there.

If you also have vfp9 at hand, then start it.
If you want it to execute a certain prg at startup you have some options, eg lookup _startup in the vfp help

Bye, Olaf.
 
I do have both the full fox pro with the vfp9.exe and I also have the foxcmd8 that is part of the other application
 
The short answer is - You don't pass parameters to vfp9.exe.

Your custom application foxcmd8 was obviously created to expect one or more parameters when it is launched.

Have you tried using the pipe ( '|' ) symbol in your BAT file to separate the command line into 'parts' - executable call | parameters?

That is one method that I have used for some command line executions of code.

Other methods have been to put a minus sign before the parameters.

NOTE - we are just making wild guesses since we have not heard of your foxcmd8. You might attempt to contact the supplier of that program.

Good Luck,
JRB-Bldr
 
Juhlhar,

This is getting a bit confusing.

Perhaps you could focus on telling us exactly what you are trying to achieve. What is your end goal? And please keep in mind that we don't know anything about your working environment, the software you are using, or what skills you have as a programmer.

If you could do that, I'm sure we will be able to help you.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
jrbbldr:

Your custom application foxcmd8 was obviously created to expect one or more parameters when it is launched.

NO, the errors shows it is not design to expect parameter, it errors if you call it with parameters.

Obviously foxcmd8 is designed to just be launched with no parameters or if it should be able to automatically execute something, but that's very unliely.

Obvious is the opposite, the error "no PARAMETER statement is found" means parameters where passed in but there is no PARAMETER statement to receive them.

jrbbldr, see for yourself, this happens with function calls, too. So suppose there would be a function foxcmd8 with no parameter statement, but you call it passing in something, then look what happens:

Code:
foxcmd8(1) && leads to error "No PARAMETER statement is found"
procedure foxcmd8()
  return 42
endproc

The only two ways to mend this is to 1. change foxcmd8.exe, only possible, if you also have the source code, or 2. DONT PASS IN ANYTHING.

If foxcmd8.exe should accept input from outside, then it would by other means than parameters. Check the documentation of it, if it's not by you. And if it's by you and you want it to accept a parameter, then add a PARAMETER statement, like so:

Code:
? foxcmd8(1) 
procedure foxcmd8()
  lparameter lnSummand
  return 41+lnSummand
endproc

The error is CLEARLY saying a PARAMETER statement is missing, there is nothing to not understand by it. It doesn't say parameters are missing.

Bye, Olaf.
 
Guys, guys, OF COURSE VFP8.exe can accept a parameter -- the name of a program to run! Been that way since the history of the product!

I see the first question I asked has not been answered:

WHAT IS foxcmd8.exe?

Having seen everything else in this thread, I now wonder:

* What gave you the impression it accepts parameters?
* What parameters are you trying to pass, and how?
* What do you expect it to do with those parameters?

Of coruse, this first question I asked still stands and is actually the most important.

We don't ask these things for our health. We actually need the information in order to help you.
 
dan, if you already now what foxcmd8 is, then enlight us. vfp8.exe is vfp 8, but juhlar never talked of VFP 8, only of foxcmd8.exe and also having VFP 9 at hand, but that doesn't help about the foxcmd8.exe

The error message clearly says foxcmd8.exe is NOT accepting any paramters.

And who said VFP8.exe can't take a parameter?

Actually any exe built by vfp can accpept certain command line parameters / switches, eg -L for specifying a resurce dll of a certain language. But for a foxpro built exe to accept just any parameter it must have a PARAMETER(S) (or LPARAMETERS) statement.

Bye, Olaf.
 
OlafDoshke said:
dan, if you already now what foxcmd8 is, then enlight us.

Read more closely. I've asked TWICE what it is, the question remains unanswered, but y'all have discussed all sorts of things like:

OlafDoshke said:
The full version of foxpro has a command window, but you don't call that via batch to execute something

This gets nowhere near answering the original question, but OF COURSE you can launch VFP with a command line parameter to run a program.
 
dan,

I was just directly answerig juhlars second question right before my answer:

juhlar said:
maybe it would be easier to ask how to get a batch file to pass commands to the command line of visual foxpro 9

Dan, You should perhaps read more thoroghly, what happened in the thread and how it evolved.

Juhlar already answered your question:
juhlar said:
foxcmd8 ... is part of the other application.

This most probably means juhlar doesn't know exactly what this is. It just came with some other application. And that leaves us with the next puzzle. I assume juhlar can't add more info about it.

Yes, dan, you can pass the filename of a prg to a vfpN.exe with any version of foxpro. But I stay with my previous answer: YOU DON'T DO THAT. At least not for distribution, because vfp8.exe or vfp9.exe is NOT among the files you are allowed to redistribute.

As we're talking to an obvious foxpro newbie, suggesting to do that will seem like a normal solution, but it's not a solution to redistribute foxpro, this would just be a solution for development tasks.

I also was adding to Mikes assumption:
Mike said:
I suspect FoxCmd8 is one of those compiled command window utilities, like FoxBox and vRunFox.

If juhlar thinks along the line of foxcmd8.exe being a dos prompt like "fox prompt", then he might think you can pass in a prg to run, like you can call cmd.exe and pass in a dos command.

Juhlar, it would help a lot, if you'd be more verbose about what you know and what you assume.

One thing is for sure_ Foxcmd8.exe is no native part of foxpro, neither foxpro 8 nor 9 and so we don't know what it does, what's it's role in that "other application". But if it's done in foxpro it can for sure accept vertain parameters, eg via -L switch or -C switch or other switches, but not just any parameter. If you created your bat as a variation of an already existing bat file, then show us, maybe we can recognize some of the standard switches foxpro itself and any exe compiled with foxpro supports and spot where you did go wrong. One easy mistake is to put a space after such a switch.

Nevertheless, if you stay this mysterious and short you'll never get an answer.

Bye, Olaf.
 
I appreciate the help so far. Here is what I have gleaned from the thread thus far:

1) foxcmd8 is not a normal part of vfp as I had originally assumed.
2) foxcmd8 probably does not accept the parameters or commands that I am trying to send it from the .bat file.
3) I am clearly not asking the right questions.

Here is what I can tell you. I have a software program that uses foxpro as the database. The vendor refuses to give us any type of documentation on the code for the software or the database itself. While running tests on the software I am attempting to understand the relationships (which are not persistent) between the tables. Because the relationships are not formally defined vfp9 was no help. I am now trying to pull the name of the fields in each table and export them to excel so that I can evaluate them there. I was trying to use a .bat file to pass the commands into the command line of either foxcmd (which appears to simply be a command line interface to the database) or vfp9.

Seeing as that does not look possible, am I going about this the wrong way? Is there an easier way to get the field names out of 200+ tables and views?

Hope this information helps.

Thanks,

Juhlar
 
First, yes, it would have helped a lot to know you want to analyse the structure of a database.

There is one thing you would help us with, at least me:
What code are you trying to exceute, what is the source code of your bat files?

using VFP9, use ADBOBJECTS() to get an array of table names from an opened database, that is, if you have a DBC additional to a set of DBF files. If the database just consists of dbf files, use ADIR() to get a list of files in a directory. Then you can process this in a loop.

AFIELDS() will give you an array of field names, COPY STRUCTURE EXTENDED will create a table containing meta data about the table structure.

If you have a DBC, simply open it and MODIFY DATABASE to get into a visual respresnetaiton of the database. Do you see no relations in there, really?

Bye, Olaf.
 
Juhlar,

Your explanation helps a lot.

Based on that, I would strongly suggest you forget about FoxCmd8. We still don't know what it is, but it is clearly no use to you. And forget about parameters and batch files and everything else.

Instead, focus on your immediate problem, which is to get a list of the names of the fields.

The easiest way to do that is to use AFIELDS(). That will get the field names into an array. Or, use COPY STRUCTURE EXTENDED to get the table structure into a cursor, which you can then copy to a CSV file, which can in turn be opened in Excel.

Now that we know what your real goal is, we should be able to talk you through the steps needed to achieve it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Olaf,

I do have a DBC, and I started with modify database prior to coming here and no there are no relationships. The vendor simply used common field names across tables that link...Why he chose to do this I have absolutely no idea, but this was confirmed by one of his DBAs.

Mike,

Being new to foxpro, when I start to type the AFIELDS() it lets me know that I need to enter an array name [,nWorkArea|cTableAlias].

Does this mean that I have to repeat this for every table?
 
I just meantioned the pure function names, you should lookup that functions in the VFP help about their parameterisation, in case of AFIELDS() there is one non optional parameter for the name of the array created and one non optional prerequisite is a table open in the current workarea.

As you are new to foxpro, please bear with me, that I can't point you to needed commands and explain each in detail, you have to go through some reading. The foxpro help has a great reference section explaining each command or function in detail.

Bye, Olaf.
 
Yes, I agree with Olaf (as usual). You should look up AFIELDS() (and the other functions and commands we suggested) in the Help.

If you still have problems with them, come back and ask a specific question. But please don't add any new questions to this thread. Start a new thread for a new question, and give it a title that indicates the nature of the problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top