Category Archives: Windows Batch Programming

Floating point operations in Windows Command Prompt

We can not perform floating point operations in Windows command prompt. For that, we need to call external script like VB Script or Java Script.

As shown in below example, we are calling vb script “ext.vbs” from within batch file to perform floating point operations.

@echo off

for /f %%x in (‘cscript //nologo ext.vbs “22/3″‘) do (
set output=%%x
echo %output%

Here is the contents of “ext.vbs” file.

‘Below script will evaluate the first argument.
WScript.Echo Eval(WScript.Arguments(0))