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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
tinfanide
Posts: 117
Joined: 05 Sep 2011 09:15

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

#1 Post by tinfanide » 14 Jan 2012 21:08

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.

Squashman
Expert
Posts: 4472
Joined: 23 Dec 2011 13:59

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

#2 Post by Squashman » 14 Jan 2012 21:27

Code: Select all

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

tinfanide
Posts: 117
Joined: 05 Sep 2011 09:15

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

#3 Post by tinfanide » 14 Jan 2012 22:02

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?

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

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

#4 Post by alan_b » 15 Jan 2012 02:35

& 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 /?

tinfanide
Posts: 117
Joined: 05 Sep 2011 09:15

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

#5 Post by tinfanide » 15 Jan 2012 02:53

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"?

Squashman
Expert
Posts: 4472
Joined: 23 Dec 2011 13:59

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

#6 Post by Squashman » 15 Jan 2012 08:42

That is a pipe. You are directing the output of one command and telling the next command to use it as input.

Squashman
Expert
Posts: 4472
Joined: 23 Dec 2011 13:59

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

#7 Post by Squashman » 15 Jan 2012 09:13


tinfanide
Posts: 117
Joined: 05 Sep 2011 09:15

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

#8 Post by tinfanide » 15 Jan 2012 09:15

Yes, I see.

tinfanide
Posts: 117
Joined: 05 Sep 2011 09:15

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

#9 Post by tinfanide » 15 Jan 2012 09:17

Thanks for your link. This really helps me kick off grasping DOS-Command

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

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

#10 Post by dbenham » 15 Jan 2012 11:51

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

Post Reply