Pause for Specified time.

May 14, 2007 at 03:54:30
Specs: XP, 2GB
Hi,

Can anybody give the command to pause the process for a specified amount of time.

I got this problem becasue in my batch script.

My program tries to install a software.
But when the installation termiates after a fraction of min.
Then i tried with pause command. then the istallation is going fine. As i know the installation completes by seeing the files i can press any key to close the CMD window.

But the users dont know about installation files. If i gave the program using "pause" they may close the CMD window as soon as the message "press any key to continue...".

I dont want to do like that.. So, please can anybody tell the command to pause the process for specified amount of time...


Thanks in advance,
Shyam.

Shyam Kumar


See More: Pause for Specified time.

Report •


#1
May 14, 2007 at 04:15:42
ping 1.1.1.1 -n 1 -w 10000 > nul
===========================
the time to wait is the 10000, time in milliseconds, so this waits 10 seconds.



=====================================
If at first you don't succeed, you're about average.

M2



Report •

#2
May 14, 2007 at 06:40:04
Hi Mechanix2Go,

The command you gave is not working in my code. Same thing happenening. my installation is aborting in between as usual.

I am giving u the full code what i made.

@echo off
Title OA or PVLite or PVThick Installation

if not defined JAVA_HOME set /p JAVA_HOME=Please enter JAVA_HOME:

set PATH=%JAVA_HOME%\bin;%PATH%

set /p Component=Please enter Viz component to install[OA/LITE/THICK]

set /p Build=Please enter the build to install

if "%Component%"=="OA" set loc=\\i2851\Viz_CD_Images\OA\X-10\%Build%\adapters_win.01
if "%Component%"=="LITE" set loc=\\i2851\Viz_CD_Images\PView\X10\%Build%\pviewrun.01
if "%Component%"=="THICK" set loc=\\i2851\Viz_CD_Images\PView\X10\%Build%\productview.01

set /p installer=Please enter the path to installer properties file of "%Component%":

for /f "tokens=2 delims==" %%i in ('findstr /C:"USER_INSTALL_DIR=" "%installer%"') do set install_loc=%%i

Set install_loc=%install_loc:\:=:%

Set install_loc=%install_loc:\\=\%

pushd "%loc%"

if "%Component%"=="THICK" (
echo %installer%
echo Installing ProductView ............
start /wait setup -f %installer% -i silent
pause
goto EOF
)

if "%Component%"=="OA" (
echo %installer%
rmdir /s /q "%install_loc%"
echo Installing OA............
start /wait setup -f %installer% -i silent

ping 1.1.1.1 -n 1 -w 300000 > null
goto EOF
)
if "%Component%"=="LITE" (
echo %installer%
echo Installing ProductView Lite............
start /wait setup -f %installer% -i silent
pause
goto EOF
)

:EOF

Output of batch file:
Please enter JAVA_HOME:d:\j2sdk1.4.2_06
Please enter Viz component to install[OA/LITE/THICK]OA
Please enter the build to install101
Please enter the path to installer properties file of "OA":c:\vizadapters-instal
ler.properties
c:\vizadapters-installer.properties
Installing OA............

After showing "Insatalling OA.."... it is closing in between of the installation....


Thanks in Advance,
Shyam.


Shyam Kumar


Report •

#3
May 14, 2007 at 07:18:45
By a quick watch I suppose your code never executes the ping command given by M2 as it abends while running setup.

Why do you code Start /wait setup as its effects is the same of the simple setup...?

A cause may be the Set Path statement at the beginning as I experienced the impossibility of modifing the native Path system variable via a batch script.


Report •

Related Solutions

#4
May 14, 2007 at 07:37:59
It will take me a while to figure out what's going on in all that ECHOing and prompting.

One thing I notice is that you don't need to indicate where EOF is with :EOF because it is 'built in'. But, strangely, you do need to code:

goto :eof


=====================================
If at first you don't succeed, you're about average.

M2



Report •

#5
May 14, 2007 at 09:43:14
Yes M2. wat you said regarding :EOF is correct.. actually i tried with out that... as it is not working i tried with different ways..

Shyam Kumar


Report •


Ask Question