1.

Solve : Batch Message?

Answer»

What is the code to make a message appear in a batch file, and what is the code to make it wait for a set amount of time?  Code: [Select]echo text
echo.text
echo %variable%
Code: [Select]ping -n 1 -w "number of miliseconds" 1.1.1.1
ex.

Code: [Select]echo I like Batch
ping -n 1 -w 1000 1.1.1.1 >nul
cls
this will echo "i like batch" text wait 1 sec and then clear the screen Quote from: devcom on August 25, 2008, 04:16:43 PM

Code: [Select]echo text
echo.text
echo %variable%
Code: [Select]ping -n 1 -w "number of miliseconds" 1.1.1.1
ex.

Code: [Select]echo I like Batch
ping -n 1 -w 1000 1.1.1.1 >nul
cls
this will echo "i like batch" text wait 1 sec and then clear the screen

both work perfect, but is there a way to make it wait without displaying anything..., and how do i make it change the title of the DOS windowchanging title is just Code: [Select]title "enter title here"
if you've got the >nul  the waiting code shouldn't PRINT anythnig to the screen.

alternative ping wait: Code: [Select] ping -n 'No. of second' 127.0.0.1>Nul
where 'No. of seconds' is replaced by the number of seconds you want to wait. It's not particuarly accurate though.

FB Quote from: fireballs on August 25, 2008, 04:24:58 PM
changing title is just Code: [Select]title "enter title here"
if you've got the >nul the waiting code shouldn't print anythnig to the screen.

alternative ping wait: Code: [Select] ping -n 'No. of second' 127.0.0.1>Nul
where 'No. of seconds' is replaced by the number of seconds you want to wait. It's not particuarly accurate though.

FB
ok, thanks works perfectly 
Code: [Select]echo off
title Macilizer
echo Macilizer starting...
ping -n 1 -w 2000 1.1.1.1 >nul
echo Initializing...
ping -n 1 -w 500 1.1.1.1 >nul
Choice /M "Do You Want To Run Mac Look-Alike PROGRAMS?"

If %errorlevel% EQU 2 goto no
If %errorlevel% EQU 1 goto yes

:yes
echo Starting Battery Meter
ping -n 1 -w 2000 1.1.1.1 >nul
start "" "C:\Program Files\Mioplanet Battery Meter\Mioplanet Battery Meter.exe"
echo Starting Konfablator
ping -n 1 -w 2000 1.1.1.1 >nul
start "" "C:\Program Files\Pixoria\Konfabulator\YahooWidgets.exe"
echo Starting Object Dock
ping -n 1 -w 2000 1.1.1.1 >nul
start "" "C:\Program Files\Stardock\ObjectDock\ObjectDock.exe"
ping -n 1 -w 2000 1.1.1.1 >nul
echo Exiting....
ping -n 1 -w 2000 1.1.1.1 >nul
exit

:no
echo Exiting....
ping -n 1 -w 2000 1.1.1.1 >nul
exit


Discussion

No Comment Found