Tracy,

Thanks for the followup on the pegged processor potential.  Your
conclusions line up with what I was thinking but I didn't have the
details on your code.

I solved the "cmd /c" puzzle by doing "cmd /?" at the command line.  The
"/c" parameter means execute the command that follows an terminate.

In my experience, the example of a redirect to a long filename that you
give, '> "C:\Temp\Space in Folder\dir.txt"])' will not work.  The string
would need to be '> "C:\Temp\Spacei~1\dir.txt"])' unless there is another
folder using the Spacei~1 in which case it might beSpacei~2 etc.

Thanks again for your help,

Joe

On Tuesday, February 22, 2011 11:15 AM, Tracy Pearson wrote:
>
>Date: Tue, 22 Feb 2011 11:15:00 -0500
>From: Tracy Pearson
>To: [email protected]
>cc:
>Subject: RE: Getting  a complete file list from a removable disc into VFP
>
>Joe Yoder wrote on 2011-02-18:
>> Tracy and all,
>>
>> I am trying to develop some competence with API calls so I setup a
>> simple bench mark and had the Performance tab on Task Manager up while
>> I ran several tests.  Here is the test routine:
>>
>> * Test DoAndWait performance
>> * Save the start time
>>   m.StTm = VAL(SYS(2))
>> * Do the call - Uncomment the one being tested
>>   ?DoAndWait("c:\windows\system32\notepad.exe Contents.txt", "NOR")
>>   *?DoAndWait("c:\windows\system32\cmd.exe /c dir c:\ /s", "HID")
>>   *?DoAndWait("c:\windows\system32\cmd.exe /c dir c:\ /s>Contents.txt",
>"HID")
>>
>> * report the elapsed time
>>   ?ALLTRIM(STR(VAL(SYS(2)) - m.StTm)) + ' Seconds this run'
>> I tried the inkey(.1) both before and after the DO EVENTS line.  I could
>> not tell any difference in the CPU utilization with or without the
>> inkey(.1) enabled in the code.  The directory scan run durations were
>> also the same with or without the inkey(.1).
>>
>> I was surprised to see that the directory redirected to a file ran in
>> 5 or 6 seconds while the one going nowhere took 11 or 12 seconds.
>>
>> I would be glad for an explanation of what is causing these results
>> but a grateful that I can at least achieve them now.
>>
>> I stumbled across the "cmd.exe /c dir"  syntax as a way to execute an
>> internal command but have never found any documentation about when
>> this is necessary.  Where can I find this information?
>>
>> It appears that one needs to convert long filenames to the 8.3 format
>> before passing them as parameters on a command line to the CreateProcess
>> routine.  Is this something that applies to all API calls?
>>
>> Thanks to all who helped me with this,
>>
>> Joe
>
>Joe,
>
>>   *?DoAndWait("c:\windows\system32\cmd.exe /c dir c:\ /s", "HID")
>
>> I was surprised to see that the directory redirected to a file ran in
>> 5 or 6 seconds while the one going nowhere took 11 or 12 seconds.
>
>Actually, the command you have printed all the results to screen, resulting
>in 11ish seconds. Direct the output to NUL when you do not really need the
>data. Yes, NUL not NULL because that's the old DOS carry over.
>
>You're saying the VFP instance you ran that notepad in did not seem to take
>a lot of processor time without the inkey(.1)? I just went back and grabbed
>that code Grig posted. My earlier statement was based on similar code I had
>written. It appears the DoEvents and the InKey(.1) result in the same
>reduction in processor intense usage. My original code I had worked out did
>not have either.
>
>> I stumbled across the "cmd.exe /c dir"  syntax as a way to execute an
>> internal command but have never found any documentation about when
>> this is necessary.  Where can I find this information?
>
>The functionality of the /c ends the parameters for CMD. So the command
>DoAndWait([C:\windows\System32\Cmd.exe dir /d c:\temp\temp >
>C:\Temp\temp\dir.txt])
>actually fails to run correctly. Place the /c before the dir and it will.
>
>> It appears that one needs to convert long filenames to the 8.3 format
>> before passing them as parameters on a command line to the CreateProcess
>> routine.  Is this something that applies to all API calls?
>
>This is how I pass long file names:
>DoAndWait([C:\windows\System32\Cmd.exe /c dir c:\temp\temp > "C:\Temp\Space
>in Folder\dir.txt"])
>
>The Command Prompt uses the double quote (") as parameter delimiters.
>
>
>Tracy Pearson
>PowerChurch Software
>
>
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to