I would like my code to run in the command line (cmd) and then output the result to a text file. The text file should then contain 'hello world'.
I tried
C:\wamp\bin\php\php5.3.13\php.exe -f "C:\wamp\www\hello.php"
The answer is rather simple,
add > answer.txt to the command and it will be saved in answer.txt
so it will be
cd "C:\wamp\bin\php\php5.3.13"
php.exe -f "C:\wamp\www\hello.php" > answer.txt
the > says that all the output must be redirected
for more information see
http://technet.microsoft.com/en-us/library/bb490982.aspx
EDIT
If you also want to provide input you can do
cd "C:\wamp\bin\php\php5.3.13"
php.exe -f "C:\wamp\www\hello.php" < input.ini > answer.txt
>answer.txtit should work