Where a batch file might seem just a bit over the top, try this nifty
trick with the More command.
By Jeffery Hicks
You?re probably familiar with the More command, which you use to page
output. But there?s another version you may not be familiar with. When
you are at a command prompt and type an opening parenthesis, (,
followed by Enter, you will get a special prompt that looks like this:
At the prompt type a command. Each new line will allow you to enter
another command. Type a closing parenthesis, ), to get back to the
main prompt. Once you hit Enter, all of your commands will be executed
>Tim: I also found that you can open the "more?" prompt and then paste a bunch of commands in as well as typing them in.
Try it out. Open a command prompt and type or simply copy and paste at
a CMD prompt:
Echo I am a command
All four commands will execute. As you see, this is like creating a
batch file -- without the file! I?d say it is also equivalent to
creating a script block in PowerShell, except this version is
interactive. Here?s another example for you to try:
Echo This is %computername%
echo It is now %date% %time%
echo Free space on drive C:
dir c:\ | find /i "free"
You can use this technique to redirect output from multiple commands to
the same file. When you get to the closing parenthesis, add > filename,
I can very easily redirect the output of three different DIR commands
to the same file.
Spelling counts and typing mistakes can?t be fixed. There?s no way to
go back once you?ve moved to the next line. But if you need to abort
what you?re doing, use Ctrl+C before you put in the
So the next time you have multiple commands you need to run -- perhaps
a series of scripts -- you don?t need to figure out how create a
batch file. Just do more!