Go Back   CityProfile.com Forum - Local City and State Discussion Forums > General Discussion > Technology
Click Here to Login

Old 08-04-2011, 09:51 AM  
ɹoʇɐɹǝpoɯ ɯnɹoɟ
VaporLung's Avatar

Join Date: Nov 2010
Posts: 728 | Kudos: +47
Images: 2
Cool little Command Prompt Trick

(Originally found at MCPMag.com)

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
in sequence.
>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 %windir%
Echo I am a command
Time /t
Date /t

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,
like this:

dir s:\*.wsf
dir f:\sa\*.*
dir c:\temp\*.vbs
) >results.txt

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
closing parenthesis.

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!

Reply With Quote
Old 08-04-2011, 06:53 PM  
island girl
juliana's Avatar

Chicago, IL
Join Date: Oct 2010
Posts: 176 | Kudos: +21
Images: 3

10 characters
"It's not the size of the lift, it's the articulation!" - Lil ED
:: Off Road North America ::
Reply With Quote

Go Back   CityProfile.com Forum - Local City and State Discussion Forums > General Discussion > Technology
Bookmark this Page!

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Suggested Threads

Powered by vBadvanced CMPS v3.2.3

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.