Skip to content

Instantly share code, notes, and snippets.

@maciakl
Last active December 14, 2015 21:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maciakl/5152273 to your computer and use it in GitHub Desktop.
Save maciakl/5152273 to your computer and use it in GitHub Desktop.
Go Nowhere, Do Nothing script. This script pretends to do work but does absolutely nothing. You do get to watch progress bars though. Also, it shows you how to create and call subroutines with parameters in Windows batchfiles.
@echo off
title GNDN
mode 65,25
color 4F
echo.
echo GNDN SUBSYSTEM RECALIBRATION
echo _________________________________________________________________
echo.
echo Level 1 Diagnostic
call :progressbar 1 10
call :progressbar 2 2
call :progressbar 1 38
echo OK
echo.
echo Level 2 Diagnostic
call :progressbar 1 15
call :progressbar 2 5
call :progressbar 1 27
call :progressbar 2 3
echo OK
echo.
echo.
echo Reticulating Splines
call :progressbar 1 10
call :progressbar 2 5
call :progressbar 1 5
call :progressbar 2 3
call :progressbar 1 7
call :progressbar 2 5
call :progressbar 1 15
echo DONE
echo.
call :wait 3
color 27
echo RECALIBRATION WAS SUCCESSFULL
echo.
pause
goto:EOF
rem Subroutine to display a fake progress bar
:progressbar
rem %~1 and %~2 are attributes passed in by caller
rem %~1 - how many seconds to wait between progress bar tics
rem %~2 - how many progress bar tics to display
for /l %%x in (1, 1, %~2) do (
rem Since there is no wait function, we're just gonna fake it
ping -n %~1 127.0.0.1 >nul
<nul set /p=^|
)
goto:EOF
rem Subroutine that waits %~1 seconds (where %~1 is parameter passed in by a caller)
:wait
ping -n %~1 127.0.0.1 >nul
goto:EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment