Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RUN a exe whose path contains spaces
Message
 
To
16/10/1997 23:20:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00055090
Message ID:
00055263
Views:
26
>>>I have a problem where I need to run a program that potentially resides in a directory such c:\Program Files\blah blah\the.exe.
>>>
>>>I'm currently building the run command in a quoted variable and executing the run with a macro as follows:
>>>
>>>xCmnd = '"' + GetTheProgram() + ' ' + GetParameters() + '''
>>>&& xCmnd would look like "C:\Program Files\Blah Blah\The.exe C:\Program Files\Blah Blah\AnotherFileName"
>>>RUN &xCmnd
>>>
>>>Fail
>>>
>>>If, however xCmnd looked like "C:\Blah\The.exe C:\Program Files\Blah Blah\AnotherFileName" it works.
>>>
>>>It appears the parses takes to the first space as the executable file for the run command. Anyone know how to solve this problem.
>>
>>I have had some problems like this before. Now, I am always using the RUN inside the macro so I now call the macro like this:
>>
>>LOCAL lcExec
>>lcExec='RUN '+everythingyouneedhere...
>>&lcExec
>
>Nope. Same results. If I move the exe to another directory where there are no spaces in the tree names it will work.
>
>What is interesting is that the parameters passed to the exe can contain paths with spaces and all works (providing I further embed those parameters in quotes.
>
>Any other suggestions (other than WIN API stuff?
>
>TIA
>
>Bill Wilson
>Sharbot.com


Include each section of the command in quotes like:
RUN 'C:\programs files\my very long name.exe' 'parameter1 and2 parameter3'

In this way RUN command should split the command on the rigth 'space'.

:0)
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform