Subject: | Re: Execute CMD
| Date: | 31 Jan 2019 23:21:07 -0400
| From: | "Kevin Zawicki" <numberjack@wi.rr.com>
| Newsgroups: | pnews.paradox-programming
|
you are quoting your \\s spaces in path
I find it easier (maybe) to write out a text file via text Stream to a batch
file, and execute batch file.
Peter <peter@removespamwhiteknight.email> wrote:
>Okay, I think I got it figured out
>Can anybody spot it?
>
>string for Pdox priv directory
>works on my computer: "D:\\Settings\\9\\Pdx\\Exp.bat"
>does not work on other computer: "E:\\My Files\\My
>Documents\\PdxPriv\\Exp.bat"
>
>
>
>On 01/28/2019 12:34 PM, Peter wrote:
>> Hi Leslie,
>> Yes you did and I implemented it.
>> To experiment I wrote out the file instead of using a variable
>> "if not execute("cmd.exe "
>> +"D:\\Corel\\Settings\\9\\Pdx\\dbCheck.bat",Yes,ExeShowNormal) then
>> errorShow()
>> return(FALSE)
>> endIf"
>>
>> The bat file is created properly and it executes if I d-click, I changed
>> the commands in the bat file to just two lines.
>> P:
>> cd Data
>>
>> The cmd window will either flash (open/close with the "/c" switch) or
it
>> opens (no "/c" switch) but it won't execute the bat file.
>>
>> Will do more experimenting today.
>>
>>
>> On 01/27/2019 06:20 AM, Leslie wrote:
>>>
>>> I think I said this once before, you cannot guarantee what the current
>>> directory is when cmd is open, so strfile should contain the fullpath
>>> to the batch file.
>>>
>>> Also any command within the batchfile should also reference files via
>>> a fullpath.
>>>
>>> just a guess
>>> Leslie.
>>>
>>>
>>>
>>> On 27/01/2019 6:39 AM, Peter wrote:
>>>> I am executing cmd from within objectpal. Opens the cmd and executes
a
>>>> bat file(strFile).
>>>>
>>>> "if not execute("cmd /c" +strFile,Yes,ExeShowNormal) then
>>>> errorShow()
>>>> endIf"
>>>>
>>>> Computer 1 - this works perfectly
>>>> Computer 2 - the dos screen opens and termintates immediately, will
not
>>>> run the bat file
>>>>
>>>> If I remove the "/C thus
>>>> "execute("cmd" +strFile,Yes,ExeShowNormal)"
>>>> Computer 1 - "Error occured trying to execute the specified program"
>>>> Computer 2 - works perfectly
>>>>
>>>> If I rewrite to include a space after cmd
>>>> "execute("cmd " +strFile,Yes,ExeShowNormal)"
>>>>
>>>> Computer 1 - opens the DOS prompt but will not run the bat file
>>>> Computer 2 - didn't try
>>>>
>>>> Anyone know why I am getting two different results? Better yet, how
do I
>>>> make Computer 2 behave like computer 1? Both are Win Xp Pro. Thanks.
>>>
>>> ---
>>> This email has been checked for viruses by AVG.
>>> https://www.avg.com
>>>
|