Re: Problems with shell_exec() running .bat with For /F

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

 



So here is the source of the problem, but not the cause.
>From the XP command line etc. the dir returns a file line of
04/02/2005  02:09 AM          19405754 filename.ext
but when invoked from shell_exec() it returns
04/02/2005  02:09                 19405754 filename.ext
which means that for some reason the PHP evoked shell isnt picking up the 
custom regional settings on the machine.
Its easy enough to work around, but is this a bug or have I missed some 
finer point about regional settings?

""Fred"" <bloggsfred00@xxxxxxxxxxx> wrote in message 
news:9C.6A.42553.94943C24@xxxxxxxxxxxxxxx
> PHP5 - Apache2 - XPSP2
> I have an XP batch file incorporating a For /F command which behaves 
> strangely if run from a shell_exec() or system().
> Specifically, if the batch is run from a command prompt or from the 
> scheduler, it works as expected, but if I run the same batch from 
> shell_exec() the For /F misbehaves interpreting token fields.
> Paraphrasing, "For /F "tokens=1-4" %%a in ('dir /-c c:\somedir') do if /I 
> %%d==somevalue dosomething" always returns the fourth space delimited 
> field for %d when run fom an XP cammand prompt or scheduler, but sometimes 
> returns the third space delimited field when run from shell_exec(). It 
> always returns the wrong field from the same dir output lines. The only 
> coincidence seems to be that it returns the wrong field when there are 
> lots of consecutive spaces preceeding the field.
> Got me beat.
> Anyone had similar issues? Please? 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux