Re: how to execute Exe file in system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$cmd = system ("\"C:\\Program Files\\GAMS23.7\\gams.exe\"
trnsport_php.gms");
$out = `$cmd`;
var_dump($out);

It shows NULL

On Fri, Feb 17, 2012 at 4:38 PM, Negin Nickparsa <nickparsa@xxxxxxxxx>wrote:

> and this One
> system ("\"c:\\program files\\myapp\\myapp.exe\" params_for_myapp");
>
>
> On Fri, Feb 17, 2012 at 4:36 PM, Negin Nickparsa <nickparsa@xxxxxxxxx>wrote:
>
>> I read about
>>
>> The useless command may be like "c:" or "cd".
>>
>> Example:
>>
>> system('c: & "C:\Program Files\..." "parameter 1" "parameter 2"');
>>
>> exec('c: & "C:\Program Files\..." "parameter 1" "parameter 2"');
>>
>> in php manual But I didn't know how to work with it
>> It doesn't use any back slashes
>>
>> On Fri, Feb 17, 2012 at 4:29 PM, Negin Nickparsa <nickparsa@xxxxxxxxx>wrote:
>>
>>> I can't move Gams because it has many dll files which should be in there.
>>> gams.exe should be execute in that path file in program Files
>>> one time I tried to do it and when It shows me missing files I copy
>>> pasted many files but It needs many other files which I regretted so it is
>>> not possible.
>>> I tried \\\
>>>
>>> string(101) "'C:/Program\\' is not recognized as an internal or external
>>> command, operable program or batch file. "
>>>
>>> On Fri, Feb 17, 2012 at 4:25 PM, Stuart Dallas <stuart@xxxxxxxx> wrote:
>>>
>>>> On 17 Feb 2012, at 12:53, Negin Nickparsa wrote:
>>>>
>>>> this one:
>>>> $cmd = 'C:/Program\ Files/GAMS23.7/gams.exe'.'
>>>> '.escapeshellarg('C:/Program Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>>>>
>>>> GENERATES:
>>>>
>>>> string(100) "'C:/Program\' is not recognized as an internal or external
>>>> command, operable program or batch file. "
>>>>
>>>>>
>>>> Ok, in that case try \\\ instead of \. Alternatively move GAMS23.7 out
>>>> of Program Files and into a directory without spaces!
>>>>
>>>> Change the \\ in the commands to just a single \ but leave the space
>>>>> after it.
>>>>>
>>>>> On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa <nickparsa@xxxxxxxxx>wrote:
>>>>>
>>>>>> ok sorry,I tried yours It generates Null.
>>>>>>
>>>>>>
>>>>>> On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas <stuart@xxxxxxxx>wrote:
>>>>>>
>>>>>>> Please quote the relevant parts of the email you're replying to -
>>>>>>> your emails have massively diminished usefulness to the archives.
>>>>>>>
>>>>>>> On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
>>>>>>>
>>>>>>> It generates NULL
>>>>>>>
>>>>>>>
>>>>>>> My bad, try this…
>>>>>>>
>>>>>>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
>>>>>>> '.escapeshellarg('C:/Program
>>>>>>> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>>>>>>>
>>>>>>> If that still doesn't seem to work, I suggest you try just executing
>>>>>>> the command without arguments…
>>>>>>>
>>>>>>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
>>>>>>>
>>>>>>> Backticks execute a command and return the output:
>>>>>>> http://php.net/language.operators.execution
>>>>>>>
>>>>>>
>>>> -Stuart
>>>>
>>>> --
>>>> Stuart Dallas
>>>> 3ft9 Ltd
>>>> http://3ft9.com/
>>>>
>>>
>>>
>>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux