Page 1 of 1

Help: Batch file running unexpectedly slowly

Posted: 22 Sep 2008 21:55
by information_dump
Hi, I have a question about batch files.

I've got a program which returns pretty much instantaneously (and runs successfully) when I run it from a command prompt.

However, when I call this same program from within a batch file, it takes about two minutes to return, although it does appear to still run successfully.

Has anyone here ever come across a similar scenario, or have any idea why this might be happening? Would it be related to the fact that the program takes a number of arguments?

Just as an example, running the program from the command prompt, I'd have something like this:

c:\>testprog /arg1 /arg2

where obviously "/arg1" and "/arg2" are the arguments. This runs and returns immediately.

Now, if I put the line

testprog /arg1 /arg2

within a batch file (containing no other commands whatsoever) called "testbat.bat" and execute the following command from the command prompt:

c:\>testbat

it'll take the program a couple of minutes to return, and I have no idea why.

If anyone could help me, it would be greatly appreciated!

Posted: 04 Oct 2008 10:21
by alan_b
Impossible question.

You will make it much easier to answer an impossible question if you give extra information :-

What is testprog ?
What is its complete name, e.g. testprog.com, testprog.exe, testprog.bat etc.
If it is a *.BAT or *.CMD file you should post the complete file.

Exactly what are the arguments /arg1 and /arg2 ?
It looks to me that you failed to quote the exact character sequence,
and although it is quite concise, it totally conceals from any experts the numerous possible errors you might have made.

Alan

Posted: 30 Dec 2008 17:45
by BatchFileCommand
The question is not impossible, it is possible that the arguments may interfere with corresponding arguments in the command prompt.

Posted: 31 Dec 2008 15:01
by alan_b
I will accept that to be pedantically correct,
it was a "possible question",
but it is impossible to answer without wasting an unacceptable amount of time and effort due to a totally inadequate definition of the situation, which I was prompting for.

I do not know what he meant by
"when I run it from a command prompt".
From where does this command prompt come ?
Does it refer to CMD.EXE or COMMAND.COM ?
Do you know ?

What sort of animal is testprog ?
Is it *.bat, or *.exe, or *.dll, or *.whatever;
any of which could have consequences that depend upon whether the system variables PATH and PATHEXT have suitable definitions.

Who is information_dump ?
Could he be a linux user who lost his way into a DOS forum ?

And as you point out, there might be a problem with his arguments, but we will never know because he has not come back since September.

I note that you failed to advise him how to correct his arguments.
Did you find it impossible to answer a "possible question" ?

Don't feel bad. There are experts with more experience than either of us, and for the last three months they all had something better to do than to answer this "possible question".

Alan