Page 1 of 1

CMD timeout (one-line command to do multiple tasks)?

Posted: 14 Jan 2012 21:08
by tinfanide
How can I in CMD do things same to what is done in the following bat commands:

Code: Select all

@ECHO OFF

::
TIMEOUT /T 5
ECHO 5 seconds have passed
::

PAUSE


IN CMD I have to do the two commands one line.

Re: CMD timeout (one-line command to do multiple tasks)?

Posted: 14 Jan 2012 21:27
by Squashman

Code: Select all

TIMEOUT /T 5 >nul & ECHO 5 seconds have passed

Re: CMD timeout (one-line command to do multiple tasks)?

Posted: 14 Jan 2012 22:02
by tinfanide
Thanks for that.
I'd like to ask more about the symbols in CMD such as
& / |

How can I use /? to look them up in the cmd console?

Re: CMD timeout (one-line command to do multiple tasks)?

Posted: 15 Jan 2012 02:35
by alan_b
& simply allows a second command to follow the first on the same line, as in this topic.

All three symbols in " & / | " appear, with many others, when you invoke
SET /?

Re: CMD timeout (one-line command to do multiple tasks)?

Posted: 15 Jan 2012 02:53
by tinfanide
Thanks. But how about this:

bitwise or "|"
in this example:

Code: Select all


TASKLIST /V /FO table | FINDSTR "string" /I



What's the use of "|" before "FINDSTR"?

Re: CMD timeout (one-line command to do multiple tasks)?

Posted: 15 Jan 2012 08:42
by Squashman
That is a pipe. You are directing the output of one command and telling the next command to use it as input.

Re: CMD timeout (one-line command to do multiple tasks)?

Posted: 15 Jan 2012 09:13
by Squashman

Re: CMD timeout (one-line command to do multiple tasks)?

Posted: 15 Jan 2012 09:15
by tinfanide
Yes, I see.

Re: CMD timeout (one-line command to do multiple tasks)?

Posted: 15 Jan 2012 09:17
by tinfanide
Thanks for your link. This really helps me kick off grasping DOS-Command

Re: CMD timeout (one-line command to do multiple tasks)?

Posted: 15 Jan 2012 11:51
by dbenham
Squashman wrote:This should help you out.
http://judago.webs.com/batchoperators.htm

Wow - That is a great site. I think I've seen references to it by name before, but never actually saw the content until now.

There are a few statements in there that are not true. (for example it states " can't be used as a FOR /F delimiter, when actually it can). But all in all it has fantastic info and is well written.


Dave Benham