I wrote a PHP script for DevelStudio that creates a batch file, inserts commands and runs it, but it gives me an unexpected T_STRING error on 2nd line, but I cant understand whats exacly wrong
$edit1 = c('Form2->edit1')->text;
$batcode = "forfiles -p "c:\kursach" -s -m *.* /D -$edit1 /C "cmd /c del @path""
//the code that will be inserted in run.bat
$file = 'run.bat'; //name of the batch file
file_put_contents($file, $batcode.'"'. EXE_NAME . '"'); //insert $batcode in $file (run.bat)
run($file); //starts a batch file
On the second line you need to escape the inner '"'
characters as '\"'
or change the outer ones to '
.
E.g:
$batcode = "forfiles -p \"c:\kursach\" -s -m *.* /D -$edit1 /C \"cmd /c del @path\""
Or
$batcode = 'forfiles -p "c:\kursach" -s -m *.* /D -$edit1 /C "cmd /c del @path"'