Not Nick
Not Nick

Reputation: 13

How to close a cmd window and open a new one to continue the script

I am making a batch file to simply open a cmd window. I am attempting to make a bit of a show before actually getting to the cmd window i can type commands in. Here's what i've come up with so far.

@echo off
ECHO Initializing super beeboop sequence...&& PAUSE
color 0a
:top
echo %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%
set /a top=%top%+1 
if "%top%"=="300" goto next
goto top
:next
pause 
goto next
START CMD
echo beep boop badoop
pause
START CMD /k

The problem is, after all the numbers go by i want the window to close and then open a new one which will enter "beep boop badoop". Which will close afterwards, finally opening the cmd window i can type in. Feel free to leave sugestions on how to fix/improve/add to this. Thanks in advance.

Upvotes: 1

Views: 145

Answers (2)

Compo
Compo

Reputation: 38718

I don't really understand why so many Cmd sessions, and the need for the GoTo's.

@Echo Off
Echo Initializing super beeboop sequence...
Color 0A
Timeout 3 /NoBreak>Nul
For /L %%A In (1 1 300) Do Echo %random%%random%%random%%random%%random%^
%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%
Timeout 5 >Nul
ClS
Color
Echo beep boop badoop
Timeout -1
Start Cmd/K

Upvotes: 1

Squashman
Squashman

Reputation: 14320

I think this will do what you want it to do. You just needed to string your commands together on one line.

@echo off
ECHO Initializing super beeboop sequence...& PAUSE
color 0a
:top
echo %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%
set /a top=%top%+1 
if "%top%"=="300" goto next
goto top
:next
pause 
Start CMD.exe /C "echo beep boop badoop & timeout /t 2 >nul & start cmd.exe /K"

Upvotes: 1

Related Questions