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

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

 



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