Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- :main
- echo Updating file...
- [PROGRESS BAR HERE]
- @echo off
- setlocal EnableDelayedExpansion
- rem Count the number of files in this dir (just as an example)
- set n=0
- for %%f in (*.*) do set /A n+=1
- rem Fill "bar" variable with 70 characters
- set "bar="
- for /L %%i in (1,1,70) do set "bar=!bar!X"
- rem Fill "space" variable with filler spaces
- set "space="
- for /L %%i in (1,1,110) do set "space=!space!_"
- rem "Process" the files and show the progress bar in the title
- set i=0
- echo Processing files:
- for %%f in (*.*) do (
- set /A i+=1, percent=i*100/n, barLen=70*percent/100
- for %%a in (!barLen!) do title !percent!%% !bar:~0,%%a!%space%
- echo !i!- %%f
- ping -n 1 localhost > NUL
- )
- title MS-DOS
- @echo off
- setlocal enableextensions disabledelayedexpansion
- for /l %%f in (0 1 100) do (
- call :drawProgressBar %%f "up test with a long text that will not fit on screen unless you have a lot of space"
- )
- for /l %%f in (100 -5 0) do (
- call :drawProgressBar %%f "going down test"
- )
- for /l %%f in (0 5 100) do (
- call :drawProgressBar !random! "random test"
- )
- rem Clean all after use
- call :finalizeProgressBar
- endlocal
- exit /b
- :drawProgressBar value [text]
- if "%~1"=="" goto :eof
- if not defined pb.barArea call :initProgressBar
- setlocal enableextensions enabledelayedexpansion
- set /a "pb.value=%~1 %% 101", "pb.filled=pb.value*pb.barArea/100", "pb.dotted=pb.barArea-pb.filled", "pb.pct=1000+pb.value"
- set "pb.pct=%pb.pct:~-3%"
- if "%~2"=="" ( set "pb.text=" ) else (
- set "pb.text=%~2%pb.back%"
- set "pb.text=!pb.text:~0,%pb.textArea%!"
- )
- <nul set /p "pb.prompt=[!pb.fill:~0,%pb.filled%!!pb.dots:~0,%pb.dotted%!][ %pb.pct% ] %pb.text%"
- type "%pb.crfile%"
- endlocal
- goto :eof
- :initProgressBar [fillChar] [dotChar]
- if defined pb.crfile call :finalizeProgressBar
- setlocal enableextensions enabledelayedexpansion
- call :getTMPFilename pb.crfile
- call :getCarriageReturnFile "%pb.crfile%"
- if "%~1"=="" ( set "pb.fillChar=#" ) else ( set "pb.fillChar=%~1" )
- if "%~2"=="" ( set "pb.dotChar=." ) else ( set "pb.dotChar=%~2" )
- set "pb.console.columns="
- for /f "tokens=2 skip=4" %%f in ('mode con') do if not defined pb.console.columns set "pb.console.columns=%%f"
- set /a "pb.barArea=pb.console.columns/2-2"
- set /a "pb.textArea=pb.barArea-9"
- set "pb.fill="
- for /l %%p in (1 1 %pb.barArea%) do set "pb.fill=!pb.fill!%pb.fillChar%"
- set "pb.fill=!pb.fill:~0,%pb.barArea%!"
- set "pb.dots=!pb.fill:%pb.fillChar%=%pb.dotChar%!"
- set "pb.back=!pb.fill:~0,%pb.textArea%!
- set "pb.back=!pb.back:%pb.fillChar%= !"
- call :getTMPFilename pb.initFile
- set pb. >"%pb.initFile%"
- endlocal & set "pb.initFile=%pb.initFile%"
- (for /f "usebackq tokens=*" %%f in ("%pb.initFile%") do set "%%f") & del "%pb.initFile%" >nul & set "pb.initFile="
- goto :eof
- :finalizeProgressBar [erase]
- if defined pb.crfile (
- if not "%~1"=="" (
- setlocal enabledelayedexpansion
- set "pb.back="
- for /l %%p in (1 1 %pb.console.columns%) do set "pb.back=!pb.back! "
- type "%pb.crfile%" & echo(!pb.back!
- endlocal
- )
- if exist "%pb.crfile%" del "%pb.crfile%" > nul
- )
- for /f "tokens=1 delims==" %%v in ('set pb.') do set "%%v="
- goto :eof
- :getTMPFileName variable
- setlocal
- set "timestamp=%time::=%"
- set "file=%temp%%~nx0.%timestamp:,=%.%random%%random%.tmp"
- endlocal & set "%~1=%file%"
- goto :eof
- :getCarriageReturnFile file
- for %%c in (certutil.exe) do (
- if not "%%~f$PATH:c"=="" (
- >"%~1" echo(DQ==
- certutil -decode -f "%~1" "%~1" >nul
- ) else (
- >"%~1._" echo Wscript.StdOut.Write^(Chr^(13^)^)
- cscript //nologo /E:VBScript "%~1._" > "%~1"
- del "%~1._" >nul 2>nul
- )
- )
- goto :eof
- @echo off
- ::PROGRESS BAR
- set /a full = 50
- for /l %%a in (1,1,%full%) do (
- CALL:ADDSPACE)
- for /l %%b in (1,1,%full%) do (
- CALL:PROGRESS %%b
- )
- del _temp.bat
- exit/b
- :ADDSPACE
- set "fullBar=%fullBar%_"
- set "tags=%tags%#"
- exit/b
- :PROGRESS
- set number=%~1
- set /a pct=full-number
- (
- echo/echo/[%%tags:~0,%~1%%%%fullBar:~0,%pct%%%]
- )>_temp.bat
- call _temp.bat
- timeout 1 1>nul&cls
- @echo off
- set load=
- set loadnum=0
- set flash=0
- set installspeed=2
- set myapp=notepad.exe
- :progressinstall
- set load=%load%Û
- cls
- echo.
- echo.
- echo.
- echo INSTALLING PLEASE WAIT
- echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- echo %load%
- echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- ping localhost -n %installspeed% >nul
- set/a loadnum=%loadnum% +1
- set/a flash=%flash% +1
- if %flash% == 9 set flash=0
- color 0%flash%
- if %loadnum% == 24 set/a loadnum=0 & set load=
- tasklist | find "%myapp%" > NUL
- If errorlevel 1 goto installcomplete
- goto progressinstall
- :installcomplete
- color 07
- cls
- echo.
- echo.
- echo.
- echo INSTALLATION COMPLETE
- echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
- echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
- echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
- echo.
- pause
- cls
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement