Re: Problems with shell_exec() running .bat with For /F
| From: | Louis Solomon [SteelBytes] | Date: | Thu, 30 Jun 2005 07:21:52 +0000 |
| Subject: | Re: Problems with shell_exec() running .bat with For /F | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-26166@lists.php.net to get a copy of this message | ||
> ... or have I missed some finer point about regional settings?
probably.
check out the 'apply all setting to the current user account and the default
user profile" in the regional control panel
--
Louis Solomon
www.SteelBytes.com
""Fred"" <bloggsfred00@hotmail.com> wrote in message
news:BB.7C.42553.6F563C24@pb1.pair.com...
> 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@hotmail.com> wrote in message
> news:9C.6A.42553.94943C24@pb1.pair.com...
>> 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?