I motored on over to the wamp\www directory and I tried this from the command prompt (brackets [ ] used here instead of < > to preserve formatting here):
[?php phpinfo.php; ?]
but Windows just complains that the command syntax is incorrect.
When using PHP from the command line you're using the Windows command line interface, not a web server. The command would be
C:\[i]current\directory[/i]> \[i]path\to\php\executable\[/i]php phpinfo.php
C:\[i]path\to\php\executable[/i]> php phpinfo.php
If you're already in the right directory, or just
C:\[i]current\directory[/i]> php phpinfo.php
if you have the PHP executable's directory in your system PATH.
And it's not necessary to create a whole PHP file just to run phpinfo():
C:\[i]arbitary\path[/i]> php -r "phpinfo()"
More information about PHP's [man]CLI[/man] is of course in the manual. Note that one of the differences is that as a CLI program PHP reads php.ini on every invocation, instead of only when the web server is restarted (because of course there is no web server in this case).