Skip to content

Instantly share code, notes, and snippets.

@davidruhmann
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidruhmann/10913762 to your computer and use it in GitHub Desktop.
Save davidruhmann/10913762 to your computer and use it in GitHub Desktop.
Batch Rounding Example
@echo off
setlocal
call :Round 12345.6 Out
echo %Out%
endlocal
exit /b 0
:Round <Input> <Output>
setlocal
for /f "tokens=1,2 delims=." %%A in ("%~1") do set "X=%%~A" & set "Y=%%~B0"
if %Y:~0,1% geq 5 set /a "X+=1"
endlocal & set "%~2=%X%"
exit /b 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment