I would like to add a progress bar or indicator to my bat file that installs msu's. I have found one online but dont know how to add it....keeps saying "missing operand" which I dont understand. Any help would be great. Here is example of bat file.... Here is the progress bar I found online.... What I would like to do is do a overall progress bar for the Title area and then do a progress bar showing individual file installation progress in the area of echo Installing %%A. I just dont know where to use this progress bar scripting in my bat file. Any help would be great. Thanks in adv. and also Thanks to rholt for the progress bar scripting.
@cerberus8855... It's not a realtime 'progressbar'... it's a workaround type of progressbar, that you need to instruct % to display during execution of your main .cmd file. RED = % you define between actions (in this example between 'ping' cmds) save code as Example.cmd; and run to see progress in operation Code: @echo off call :progress 0 ping -n 5 127.0.0.1 >nul call :progress 5 ping -n 5 127.0.0.1 >nul call :progress 10 ping -n 5 127.0.0.1 >nul call :progress 15 ping -n 5 127.0.0.1 >nul call :progress 20 ping -n 5 127.0.0.1 >nul call :progress 25 ping -n 5 127.0.0.1 >nul call :progress 30 ping -n 5 127.0.0.1 >nul call :progress 35 ping -n 5 127.0.0.1 >nul call :progress 40 ping -n 5 127.0.0.1 >nul EXIT :progress SETLOCAL ENABLEDELAYEDEXPANSION SET ProgressPercent=%1 SET /A NumBars=%ProgressPercent%/2 SET /A NumSpaces=50-%NumBars% SET Meter= FOR /L %%A IN (%NumBars%,-1,1) DO SET Meter=!Meter!I FOR /L %%A IN (%NumSpaces%,-1,1) DO SET Meter=!Meter! TITLE Progress: [%Meter%] %ProgressPercent%%% ENDLOCAL
Hey Cerberus, The Progress bar in the taskbar is a nice trick, as well as the use of the FOR statement with wildcard for your .msu files so you don't have to list seperate. Here is another way of doing the progress bar that I use. (Runs horizional bar in console). P.S. Also if you have a lot of updates like I do and don't want to hang around your computer and watch paint dry you can add a .wav file to notifiy you that it's done. If you want the code for that let me know and I will post it. Dos_Probie Code: @echo off&color e setlocal EnableDelayedExpansion :: PBar.Updates.cmd :: INSTALL for /f %%a in ('dir /b %systemdrive%\msu\*.msu') do ( CLS echo Installing %%A %windir%\System32\wusa.exe %systemdrive%\msu\%%a /quiet /norestart ) goto :progressbar :: EYECANDY :progressbar set Counter=0 set Schalter=2 set Width=0 :1 title [ + WINDOWS UPDATES INSTALLER + ] set /a Counter=%Counter% + 1 set /a Display=%Counter% / 2 FOR /L %%A IN (1,1,%Display%) DO ( set Display=!Display!² ) cls echo Finalizing Windows Updates... %Counter%%% echo ²!Display:~2,47! ping localhost -n 1 >nul if "%Counter%" == "100" goto :1-End goto :1 :1-End echo. echo. echo. echo ALL UPDATES HAVE COMPLETED SUCCESSFULLY..WINDOWS WILL NOW REBOOT. :: DELAY ping 1.1.1.1 -n 1 -w 5000 >null :: REBOOT shutdown /r /t 1 endlocal exit
Cerberus... PM me your email addy and I will send you the link to d/l my notify wave.. (mdl would not allow me to post link here since I just joined and dont have nuff posts..go figure)
Thanks for all the info on progressbar but I was looking for something real time.....no biggie. I created a vbs file to run .wav file at end of installation to let me know it is finished instead of watching it the whole time. lol Thanks again for all the input. Take care.
Glad you got it worked out... you could also have done the wave from the batch without adding the .vbs Code: :: NOTIFY start/min sndrec32 /play /close %windir%\media\Peanuts.wav :: DELAY ping -n 14 localhost 1>NUL
doin it that way will open player which I didnt want....using vbs just plays sound without opening player min to desktop. Like the vbs better personally.
Please how to Add Percentage for Code: @ECHO OFF SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION PUSHD %~dp0 FOR %%A IN (*-KB*.MSU) DO ( CALL :SUB %%~nA ECHO= Installing KB!KB_NUM! >NUL TIMEOUT /t 3 WUSA "%%~fA" /quiet /norestart) ECHO= == Press any key to restart == >NUL PAUSE SHUTDOWN.EXE /r /t 0 GOTO :EOF :SUB SET "KB_NUM=%*" FOR /F "DELIMS=-" %%B IN ("%KB_NUM:*-KB=%") DO SET "KB_NUM=%%B"
You could stack beeps all on one line also ... echo aY | choice /n&echo aY | choice /n&echo aY | choice /n
Or try some eye candy like this.. Code: @echo off&color e setlocal EnableDelayedExpansion title [ MULTI-UPDATE INSTALLER ] :: Multi.UpdateInstaller.cmd :: AUTO INSTALLS .MSU UPDATES IN NUMERICAL ORDER :: MULTIPLE INSTALLER for /f %%a in ('dir/b %systemdrive%\Installs\updates\*.msu') do ( echo == Installing Update == "%%a" echo. start /wait wusa %systemdrive%\Installs\updates\%%a /quiet /norestart ) goto :progressbar :: EYECANDY :progressbar set Counter=0 set Schalter=2 set Width=0 :1 title [ + WINDOWS UPDATES INSTALLER + ] set /a Counter=%Counter% + 1 set /a Display=%Counter% / 2 FOR /L %%A IN (1,1,%Display%) DO ( set Display=!Display!² ) cls echo Finalizing Windows Updates... %Counter%%% echo ²!Display:~2,47! ping localhost -n 1 >nul if "%Counter%" == "100" goto :1-End goto :1 :1-End echo. echo. echo. echo ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ echo Ý ÚÄÄÄ¿Þ echo Ý All Updates Installed Successfully ³ û ³Þ echo Ý ÀÄÄÄÙÞ echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß echo. echo. echo. echo == Press any [KEY] to Close This Screen ==&pause>nul echo. exit
Since you have taken no part in this Topic, AhrimanSefid, it is impossible for me to guess what you are having difficulty with. Please post your entire batch file and explain what exactly is happening when you run it!
Try This.. ~DP Code: @echo off&setlocal ENABLEDELAYEDEXPANSION&color 1f&&title, [ WUSA - 8.1 UPDATE INSTALLER ] pushD "%~dp0" & cd /d "%~dp0" :: ### SCAN FOR UPDATES-------------------------------------------------------- for /F %%a in ('dir Updates\msu\*.msu ^|findstr /i "file(s)"') do set z=%%a echo Number Of Updates Found: %z% echo:&echo: :: ### INSTALLING UPDATES (reads updates in numerical order)------------------- echo == Installing %z% Windows Updates..(This may take a while, Please Wait) echo: for /R "%~dp0" %%A IN (*.MSU) DO ( SET /A COUNT+=1 ECHO= Installing !COUNT! of %z% = %%~nA >NUL TIMEOUT /t 3 start /wait WUSA "%%A" /quiet /norestart ) popD endlocal cls :: ### NOTIFICATION COMPLETE (plays selected .wav file when done)-------------- set "wav=%windir%\media\Ring10.wav" echo All Updates Have Completed Successfully.. start /min wmplayer.exe /play %wav% timeout /t 7 /nobreak>nul taskkill /f /im wmplayer.exe>nul exit
Did I understand that correctly? You want to install some applications in the background, (so that your end users are effectively unaware that you are installing them). Then you want to graphically show the progress of the 'silent' processes to the same end users, (so that they are fully aware that you are installing them).