2

I'm trying to make a command sleep after some seconds.

For example: tree & timeout /t 1

Then it would only show the top of the folders.

I have tried:

@echo off
Cd c:\Windows
Tree & timeout /t 1
Echo !
Pause >nul

and

Cd c:\Windows
Tree & ping 1.1.1.1. -n 1 -w 1000 >nul
Echo !
Pause >nul
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Jonathan
  • 509
  • 5
  • 8
  • 1
    I'm pretty sure that this will not be possible using only a single batch file. The commands are run *in order*, from top to bottom, just as if you'd typed them into the command prompt yourself. So you'd need a second batch file that could kill the process launched by the first. That starts getting ugly, maybe it's time to look for alternative solutions... – Cody Gray - on strike Jul 28 '13 at 13:43
  • I am just guessing here, though. Someone *might* know a way, that's why I just posted a comment instead of an answer. I'm just saying not to hold your breath. :-) – Cody Gray - on strike Jul 28 '13 at 13:49
  • So is it possible to take out / break(c^) one command in a batch without writing millions of codes, reprogramming the os and win a price for doing all this? (*lol*) – Jonathan Jul 28 '13 at 13:50
  • possible duplicate of [Windows batch: analogue for \`timeout\` command](http://stackoverflow.com/questions/12394338/windows-batch-analogue-for-timeout-command) – Ansgar Wiechers Jul 28 '13 at 13:51
  • (Hade typing on iphone, they get so confused by return button and add comment button, lol xD) – Jonathan Jul 28 '13 at 13:54
  • 1
    Just because you put 2 commands in one line with an ampersand between them doesn't mean they're run in parallel. The ampersand is for daisy-chaining commands. The 2nd command will start only after the first one finishes. – Ansgar Wiechers Jul 28 '13 at 13:55
  • Maybe the selection would be to make a mulit command like opening programs through programs? (Witch i have tried) – Jonathan Jul 28 '13 at 13:55
  • Example tree > timeout /t 1. Like start hallo.txt > notepad.exe > explorer.exe – Jonathan Jul 28 '13 at 13:57
  • Idk, but when i find out how i'll let you know ;-). Regards J – Jonathan Jul 28 '13 at 14:01
  • I marked this question as a duplicate of an already existing similar question. I suggest you take an actual look at the answers to that question. – Ansgar Wiechers Jul 28 '13 at 14:12

2 Answers2

4

Just make a LMC* in the Windows command shell window.

* Left Mouse Click

Endoro
  • 37,015
  • 8
  • 50
  • 63
0

This will show a page at a time, if that is what you need:

tree | more
foxidrive
  • 40,353
  • 10
  • 53
  • 68