How To Start @echo off Script After @powershell Script in same BATCHFiLE?
Posted: 12 Sep 2019 17:34
I was wondering if anyone knows if its possible to make a Batch script execute Powershell command and then execute @echo off right after?
Let me explain in more details.
I have a batch script
So that part is actually working but I would like to add a batch script into the same file.
•And How to make when the second script restart it reload from the first script (animated text) instead of going back to TITLE..? •
I did not create theses script that I found on Google and they are both working good separately.
BUT I would like to join 2 of them in a single .BAT file.
I tried many many different methods and always not working or if it is working the first text is not animated anymore.
Let me explain in more details.
I have a batch script
that open a CMD and animate my text and here is the code:BATCH-COLORS.BAT
Code: Select all
@powershell "gc '%~f0'|select -skip 1|%%{$_.getenumerator()|%%{write-host $_ -nonewline -foregroundcolor black -backgroundcolor darkred;sleep -milliseconds 100};''}"& pause>nul& exit/b
[============================================]
A SiMPLE BATCH COLORS TUTORiAL WiLL FOLLOW...
PERSONAL REMENDER =D
[============================================]
• And execute it like-so when the animated text finish; I can press any key to continue (or ENTER) and it would clear the same cmd prompt and start the next batch script. Batch script I would like to start after animated text:BATCH-COLORS.BAT
Code: Select all
@echo off
:TITLE
title DELvEK .BAT COLORS TUTORiAL
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
echo.
call :ColorText 02 "HERE iS SOME EXAMPLES OF BATCH COLORS"
echo.
echo ===========================================
call :ColorText 0a "light green"
call :ColorText 02 " - "
call :ColorText 0F " [black background]"
echo.
call :ColorText 0c "light red"
call :ColorText 02 " - "
call :ColorText 0F " [black background]"
echo.
call :ColorText 0b "light aqua"
call :ColorText 02 " - "
call :ColorText 0F " [black background]"
echo.
call :ColorText 0d "light purple"
call :ColorText 02 " - "
call :ColorText 0F " [black background]"
echo.
call :ColorText 0e "light yellow"
call :ColorText 02 " - "
call :ColorText 0F " [black background]"
echo.
call :ColorText 07 "BLACK BACKGROUND on WHiTE TEXT"
echo.
call :ColorText 19 "BLUE BACKGROUND on LiGHTBLUE TEXT"
echo.
call :ColorText 2F "GREEN BACKGROUND on WHiTE TEXT"
echo.
call :ColorText 4e "RED BACKGROUND on LiGHTYELLOW TEXT"
echo.
echo ===========================================
call :ColorText 0a "MY LEGEND OF POSSiBLE COLORS iN NEXT PAGE"
echo.
echo ~DELvEK
pause
goto CONFIRM
:CONFIRM
cls
call :ColorText 02 "WOULD YOU LiKE TO SEE THE LEGEND OF ALL POSSiBLE BATCH COLORS"
echo.
echo *MAXiMiZE YOUR CMD WiNDOW FOR BETTER RESULTS*
echo.
call :ColorText 0a "("
call :ColorText 09 " YES"
call :ColorText 0a " or"
call :ColorText 04 " NO"
call :ColorText 0a " )"
set/p "cho=>"
if %cho%==Y goto YES
if %cho%==YES goto YES
if %cho%==yes goto YES
if %cho%==y goto YES
if %cho%==n goto REFUSED
if %cho%==NO goto REFUSED
if %cho%==no goto REFUSED
if %cho%==N goto REFUSED
call :ColorText 04 "OOPS, iNVALiD CHOiCE"
pause
goto CONFIRM
:YES
cls
echo.
echo ===========================================
call :ColorText 0F "BATCH COLORS LEGEND _ BY DELvEK"
echo.
echo ===========================================
call :ColorText 0a "Colors are specified by"
call :ColorText 0F " TWO"
call :ColorText 0a " hex digits"
echo.
call :ColorText 0a "The"
call :ColorText 0F " FiRST"
call :ColorText 0a " correspond to the"
call :ColorText 0F " BACKGROUND"
echo.
call :ColorText 0a "The"
call :ColorText 0F " SECOND"
call :ColorText 0a " correspond the"
call :ColorText 0F " TEXT COLORS"
echo.
echo.
call :ColorText 0a "[eg]"
echo.
call :ColorText 0F "ColorText b0"
call :ColorText 0a " will give="
call :ColorText b0 "LiGHT AQUA BACK+BLACK FONT"
echo.
call :ColorText 0F "ColorText 2c"
call :ColorText 0a " will give="
call :ColorText 2c "GREEN BACK+LiGHT RED FONT"
echo.
call :ColorText 0F "ColorText 4b"
call :ColorText 0a " will give="
call :ColorText 43 "RED BACK+LiGHT AQUA FONT"
echo.
call :ColorText 0F "ColorText 1e"
call :ColorText 0a " will give="
call :ColorText 16 "BLUE BACK+LiGHT YELLOW FONT"
echo.
call :ColorText 0F "ColorText 6d"
call :ColorText 0a " will give="
call :ColorText 65 "YELLOW BACK+LiGHT PURPLE FONT"
echo.
call :ColorText 0F "ColorText 5f"
call :ColorText 0a " will give="
call :ColorText 5F "PURPLE BACK+LiGHT WHiTE FONT"
echo.
call :ColorText 0F "ColorText 70"
call :ColorText 0a " will give="
call :ColorText 70 "WHiTE BACK + BLACK FONT"
echo.
echo.
echo [Make your own with colors hex digits below]
echo ===========================================
echo 0 = Black 8 = Gray
echo 1 = Blue 9 = Light Blue
echo 2 = Green A = Light Green
echo 3 = Aqua B = Light Aqua
echo 4 = Red C = Light Red
echo 5 = Purple D = Light Purple
echo 6 = Yellow E = Light Yellow
echo 7 = White F = Bright White
echo ===========================================
call :ColorText 04 " DELvEK"
echo.
pause
cls
call :ColorText 04 "THE SCRiPT WiLL NOW RESTART..."
echo.
pause
cls
goto TITLE
:REFUSED
cls
call :ColorText 04 "OK BYE BYE, SEE YOU NEXT TiME =D"
echo.
echo.
pause
goto END
:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof
:END
I did not create theses script that I found on Google and they are both working good separately.
BUT I would like to join 2 of them in a single .BAT file.
I tried many many different methods and always not working or if it is working the first text is not animated anymore.