Project BetterBatch is a collection of useful batch plugins.
- MCONST plugin - mconst.bat - Math constants for batch, view code for more details
- MATH plugin - math.bat - Floating-point operations in batch, requires Python interpreter
- SVTOCMD plugin - svtocmd.bat - Allows you to set a variable to the output of a command.
- TRIG plugin - trig.bat - Trigonometric functions in batch
In order to use these as commands (without file path and .bat extension) you need to either add the files to a directory that is included in %PATH% or add the current directory to %PATH%.
Sets the following variables.
mconst.pi = 3.141592653589793 = pi
mconst.phi = 1.61803398875 = phi (golden ratio)
mconst.e = 2.718281828459045 = e (Euler's number)
mconst.r2 = 1.41421356237 = square root of 2
mconst.r3 = 1.73205080757 = square root of 3
mconst.tau = 6.28318530718 = tau (2*pi)
More constants will be made in the future.
call mconst
Adds floating-point support to batch. Requires Python interpreter.
Usage:call math [expression]
e.g: call math 1.56+55.753
Allows you to set a variable to the output of a command. Can be used with MATH plugin and TRIG plugin.
Usage: call svtocmd [variable] = "[command]"
e.g: call svtocmd val = "echo hi"
Example of use with MATH plugin: call svtocmd num = "math 345.7"
Example of use with TRIG plugin: call svtocmd num = "trig sin 45 deg"
Use trigonometric functions in CMD and batch. Requires Python interpreter.
Usage: call trig [function] [value] [deg/rad]
e.g. call trig sin 60 deg
Please note that for the trigonometric function names, the list that you can get using Python:help(math)
should be used.
Use exponents in CMD and batch. Requires Python interpreter.
Usage: call exp [number] [exponent]
e.g. call exp 3 4
More plugins and scripts will be added soon.