I have this Batch file which looks for a string through the files contained in a folder.
@echo off
pushd "%1"
findstr /m /C:%2 *
popd
If I execute that from a command line, it prints the names of the files containing the searched string.
From PHP, the Batch file is being executed with this command:
system("cmd /c C:/path/myFile.bat C:/path toSearch", $returned);
The problem is that the $returned
element is a string instead of an array.
Each of its elements is separted by a white space.
I was thinking of exploding it but it's not possible as some files contain also white spaces.
What is interesting is that in the source code of the page in which I print the resulting string each of the elements is in fact is one line, like so:
element1
second element
third element
But the resulting HTML code is this way:
element1 second element third element
Any suggestion?
, the web page will not break the lines) – Royal Bg Jan 15 '14 at 16:58