Home > Software design >  DOS v6 era batch echo and ver on same line
DOS v6 era batch echo and ver on same line

Time:02-22

What I have: I have a simple batch file with ASCII characters to make a semi graphical menu for MS DOS, drawing a box and placing text with "@echo off" at the start of my file and each line in editor beginning with "echo". I have not implemented color codes, nothing fancy yet. Is there a way to display the output of the 'ver' command on the same line as something that is 'echo'd? Basically, I would like to attempt and achieve and output on a line similar to:

||            <---MS-DOS ver. 6.22--->               ||

Where the pipes are ASCII characters (ALT-186) and 'escape' the echo to run 'ver' then return to printing the end character (alt-186)

I remember doing something like it YEARS ago when I was fumbling around on my computer, but unlike riding a bike, I have forgotten many tricks I had at the time.

I have Googled for quite some time, the last few days between work and sleep on my free time, but everything is geared toward the Windows XP or newer command line instead of DOS. I have read many articles on batch scripting and while helpful in relearning other tricks, they are all still geared toward newer CLI. I have read up on escaping and for some reason I am just not getting it. Maybe I have spent too much time trying to figure this out on my own and have burned out? Any help or link to the proper articles will be appreciated. Sample code even better as that is how I learned way back then.

CodePudding user response:

For the case of MSDOS-Version exists a simple solution.

echo @prompt $b$b $V $b$b > temp.bat
%comspec% /c temp.bat

This works, because $V will be translated into the MSDOS-Version, for output of other programs it's more complicated.
Attention: It only works inside a batch program, because variable expansion isn't supported on the command line.
On the command line you could use:

echo @prompt $b$b $V $b$b > temp.bat
C:\command.com /c temp.bat

In MS-DOS 6.22 it's tricky to output text without line feed.
In the most cases you should build the complete line before you try to output it.
Or you can try predefined files without a linefeed.

CodePudding user response:

Today I do the echo without line feed this way, ...

echo.|set /P =text without CR/LF

... but I can't say if this would have worked in the early nineties.

  • Related