How do you slow down the output from a DOS / windows command prompt
I have lots of experience of writing php scripts that are run in the context of a webserver and almost no experience of writing php scripts for CLI or GUI output.
I have used the command line for linux but do not have much experience with DOS.
Lets say I have php script that is:
<?php
echo('Hello wor开发者_JS百科ld');
for ($idx = 0 ; $idx < 100 ; $idx++ )
{
echo 'I am line '. $idx . PHP_EOL;
}
Then, I run it in my DOS Command prompt:
# php helloworld.php
Now this will spurt out the output quickly and i have to scroll the DOS command window up to see the output.
I want to see the output one 'screen full' at a time.
How do you do that from the perspective of a DOS user?
Furthermore, although this is not my main main question, I would be also interested in knowing how to make the php script 'wait for input' from the command prompt.
php helloworld.php | more
More on more
.
More on command line redirection.
You can redirect the output to a text-file and refer the text-file after the command execution is completed.
C:/>dir > output.txt
In general, I'd count however many lines, then stop and wait for a user input. Perhaps with an "any key to continue" if there's a possibility of confusion.
You could also build in a time delay, but personally I hate programs that display a message for a fixed amount of time and then clear it. What if someone walks in the office and distracts me just as the message comes up? I prefer requiring a positive response.
精彩评论