You are not logged in.

#1 10 Oct 2019 01:27

Rekrul
Member
Registered: 17 Apr 2016
Posts: 98

Is there any tool to add arithmetic functions to *TRUE* MS-DOS?

I wasn't sure where to post this...

Is there any freeware program/tool that will add arithmetic functions to batch files under true MS-DOS?

In a Windows batch file you can use the SET command to perform basic arithmetic, but that doesn't work under MS-DOS.

I've Googled and although I found a command line program for MS-DOS (EVAL.EXE) that seems like it would do what I want, but naturally the instructions have exactly zero examples of its usage and so far I haven't been able to figure out how to make it work properly with variables.

All the other command line calculators I found just print the result to the screen.

It doesn't help that apparently the command line in Windows is considered MS-DOS, guaranteeing that the majority of the pages that claim to have "MS-DOS" information are really talking about the command line in Windows.

I'm looking for something that will work in true MS-DOS mode, not Windows.

I want it to add some functions to a batch file that will be run in DOSBox. I could accomplish what I want to do by using IF statements and manually setting the variable values myself, but I was hoping to find a more elegant solution.

Offline

#2 14 Oct 2019 00:36

Rekrul
Member
Registered: 17 Apr 2016
Posts: 98

Re: Is there any tool to add arithmetic functions to *TRUE* MS-DOS?

A user on another forum had the answer for me, XSET;

http://xset.tripod.com/

It has even more features than the Windows SET command and has an MS-DOS version.

Offline

#3 18 Apr 2020 10:37

npocmaka
Member
From: Bulgaria
Registered: 03 Dec 2009
Posts: 446

Re: Is there any tool to add arithmetic functions to *TRUE* MS-DOS?

Here's a simple way to make calculations with batch files:

@if (@X) == (@Y) @end /*
@cscript //E:JScript //nologo "%~f0" "%*"
@exit /b %errorlevel%
*/WScript.StdOut.WriteLine(eval(WScript.Arguments.Item(0)));

if the script above is called calcjs.bat you can use it like:


call calcjs.bat "4+5/6"

Last edited by npocmaka (18 Apr 2020 10:49)

Offline

Board footer

Powered by