Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

change color batch

@echo off
REM https://pastebin.com/zjYwSqUM
Title Multi-Ping hosts Tester with colors updated on 2021 by Hackoo
call :init
set "URLS=%~dp0URLS.txt"
If Not exist "%URLS%" goto CreateDummyFile
mode con cols=70 lines=35
set "LogFile=PingResults.txt"
If exist "%LogFile%" Del "%LogFile%"
echo(
call :color 0E "      ------- Ping status of targets hosts -------" 1
echo(
(
    echo ******************************************************
    echo   PingTest executed on %Date% @ Time %Time%
    echo ******************************************************
    echo(
) > %LogFile%
Setlocal EnableDelayedExpansion
for /f "usebackq delims=" %%a in ("%URLS%") do (
    Call :StringFormat "%%a"
    for /f "tokens=2 delims=[]" %%b in ('ping -n 1 !URL!') do set "ip=%%b"
        ping -n 1 !URL!>nul && set "msg=!URL! - !ip! ALive ok" && Call :Color 0A "     !msg!" 1 || set "msg=!URL! - !ip! Dead failed to respond" && Call :Color 0C "     !msg!" 1
        echo !msg! >> %LogFile%
    )
)
EndLocal
Start "" "%LogFile%" & TimeOut /T 5 /Nobreak>nul & exit
::************************************************************************************* 
:init
prompt $g
for /F "delims=." %%a in ('"prompt $H. & for %%b in (1) do rem"') do set "BS=%%a"
exit /b
::*************************************************************************************
:color
set nL=%3
if not defined nL echo requires third argument & pause > nul & goto :eof
if %3 == 0 (
    <nul set /p ".=%bs%">%2 & findstr /v /a:%1 /r "^$" %2 nul & del %2 2>&1 & goto :eof
) else if %3 == 1 (
    echo %bs%>%2 & findstr /v /a:%1 /r "^$" %2 nul & del %2 2>&1 & goto :eof
)
exit /b
::*************************************************************************************
:ReplaceString <Data> <String1> <String2>
(
    echo Wscript.echo Replace("%~1","%~2","%~3"^)
)>"%tmp%\%~n0.vbs"
for /f "delims=" %%a in ('Cscript /nologo "%tmp%\%~n0.vbs"') do ( set "URL=%%a" )
If Exist "%tmp%\%~n0.vbs" Del "%tmp%\%~n0.vbs"
exit /b
::*************************************************************************************
:StringFormat <URL>
(   
    echo Function StringReplace(Str^)
    echo    Str = Replace(Str,"http://",""^)
    echo    Str = Replace(Str,"https://",""^)
    echo    StringReplace = str
    echo End Function
    echo wscript.echo StringReplace("%~1"^)
)>"%tmp%\%~n0.vbs"
for /f "delims=" %%a in ('Cscript /nologo "%tmp%\%~n0.vbs"') do ( set "URL=%%a" )
If Exist "%tmp%\%~n0.vbs" Del "%tmp%\%~n0.vbs"
exit /b
::*************************************************************************************
:CreateDummyFile
(
    echo http://www.hyperdebrid.com
    echo http://www.fakirdebrid.net
    echo http://www.keepfiles.fr
    echo http://www.4shared.com 
    echo https://1fichier.com
    echo http://www.mega.co.nz
    echo http://www.mediafire.com
    echo http://www.uploaded.net
    echo http://www.oboom.com
    echo http://www.letitbit.net
    echo http://www.keep2share.cc
    echo http://alfafile.net
    echo https://www.bigfile.to
    echo http://www.dailymotion.com
    echo http://www.datafile.com
    echo http://www.Depfile.com
    echo http://www.Dropbox.com
    echo http://www.Extmatrix.com
    echo http://www.Fboom.me
    echo http://www.Filefactory.com
    echo http://www.Filesmonster.com
    echo http://www.Fshare.vn
    echo http://www.Keep2share.com
    echo http://www.Mega.nz
    echo http://www.Rapidgator.net
    echo http://www.Scribd.com
    echo http://www.Soundcloud.com
    echo http://www.Speedyshare.com
    echo http://www.Turbobit.net
    echo http://www.Vimeo.com
 )>%URLS%
start /b "" cmd /c "%~f0" & exit
::*************************************************************************************
Comment

batch color change

rem For color codes type on command prompt color /?

color COLOR CODE HERE
Comment

PREVIOUS NEXT
Code Example
Shell :: ubuntu list compillers 
Shell :: instalacion mkweb 
Shell :: how to upgrade my psql client version cloud9 
Shell :: grep string in file 
Shell :: airodump output to file 
Shell :: rsyslogd verify service is running 
Shell :: add user to vboxuser gruop arch 
Shell :: ignore pre-commit hook 
Shell :: linux lastpass export data 
Shell :: nativescript/theme with nativescript 8 
Shell :: bijoy bangla keyboard for linux 
Shell :: mongo import all from bson 
Shell :: nativescript sidedrawer 
Shell :: /lib/systemd/system/gammu-smsd.service:9: Neither a valid executable name nor an absolute path: ${CMAKE_INSTALL_FULL_BINDIR}/gammu-smsd 
Shell :: fedora videos not working without bluetooth 
Shell :: ubuntu burg install 
Shell :: no matches found: *.dmg 
Shell :: wget -O /etc/enigma2/iptv.sh 
Shell :: how to open a window using linux terminal 
Shell :: crosh hacking commands 
Shell :: heroku Failed to install gems via Bundler when remove gem rails 
Shell :: louch tensorboard on remote server 
Shell :: How do I clone a git repository with extraheader 
Shell :: unintsall from ubuntu 
Shell :: Getting Uptime and Load Averages 
Shell :: Automatically run program on Linux startup via rc.local 
Shell :: brew install spectacle 
Shell :: validate ssh key 
Shell :: install openjdk debian 
Shell :: how to install "adguard home" using snap store cli 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =