I'm running into an issue while writing a batch file. I wonder if anyone might have a solution for me. This file is very long so I am trying to figure out a way to do less code writing. I have many echo messages that get displayed for a few seconds and then disappear when the file moves on to the next screen/code. I know I can write it something like this...
@echo off
echo Message
ping localhost -n 3 >nul
cls
Writing ping localhost -n 3 >nul
every time I want a delay is time consuming. I know I could copy and paste but that is not ideal for my situation either. I had the idea of setting a variable to equal ping localhost -n 3 >nul
written as,
set delay3=ping localhost -n 3 >nul
this would allow me to just type %delay3%
to save time. I found this functionally works fine but it has a side effect. When written this way,
@echo off
set delay3=ping localhost -n 3 >nul
echo Message
%delay3%
cls
my batch file will display all the ping data on screen even though I've written @echo off
at the beginning of my script. Just to be clear, this data only shows up on screen when I use the %delay3%
version of the code. Does anyone know of a way to make the ping data not show up on screen when coding it this way?