• Please review our updated Terms and Rules here

Help with custom autoexec messages?

Anonymoose

Member
Joined
Feb 19, 2024
Messages
44
Hello,
Not sure if this should go here, but I wanted to add a message to autoexec, and upon loading into Compaq Dos 3.31, it says “Syntax Error” on some of the echo lines, for instance the vertical bar ( | ). I’m not sure what to do, I’ve tried loading graftabl but that’s all I could think of. Any ideas?
 
The easy way to handle a large number of complicated lines is to have the autoexec TYPE text files.

Try placing the ECHO line in quotations marks. That works with some versions of DOS. Edit: Don't bother with 3.31 since that displays the quotation marks. There are more complicated methods involving the use of a variable but I would have to experiment to create a working example.

Norton Utilities had a program called Batch Enhancer that included a box command and made most fancy batch constructs easy. Other utilities did the same.
 
Last edited:
Well I could attach the whole ascii image, but for the sake of space here’s one instance:

/`'---.._/ /.\_ ____..'| |_/

i assumed it broke because of the vertical bars, since any line without them displays fine. I guessed it had to do with the extended ascii characters, but then again I don’t know much about them to really have a good answer. The TYPE command worked, but I’d still like an answer to know what may have gone wrong
 
It would have been helpful to show us the .bat file.

For that vertical line, try using a ^ character. first - see here.

Note from the link: Command characters will normally take precedence over the ECHO statement
e.g. The redirection and pipe characters: & < > | ON OFF


That vertical line character is a command character.

You can also look at an example problem and solution here.

Hope it helps.
 
Last edited:
"Vertical bar" is a pipe. Pipe is a mechanism used to chain inputs and outputs of command line programs. While DOS doesn't implement pipes in the same way as Unix, the token | is the same. Redirections <>, too.

So shell thinks your data is actually a command. In order to make it think otherwise, you need to escape the ambiguous token. That means prepending an escape character, ^ for DOS, \ for Unix. Then it knows what not to do with it.
 
When I try the escape character in an ECHO command on 3.31, I receive a syntax error. I have seen examples that placed the escape character in a variable but that has not been something I have done.

DOS331.png
 
This problem stems from the way Microsoft added the Unix functionality to MS-DOS back in version 2.0. While Unix had the escape character \ to prevent the shell from treating the vertical bar as a pipe symbol, no escape character was added in to MS-DOS's COMMAND.COM preventing the use of the vertical bar, and the > < symbols from being used as data to commands.

They slowly added ways around this, such as using $b in place of the bar in the PROMPT command, and eventually added using quotes around text. But the escape character ^ wasn't added to DOS, it is a Windows addition.

All this made many, many people come up with lots of ways around the problem. You can find a lot of little programs to "fix" the problem in Simtel archives, for example.

@Chuck(G)'s suggestion can be accomplished easily in DOS 3.31 by holding down the Alt key and pressing the numbers 179 on the numierc key pad. NOTE: You have to use the numeric key pad.
 
All the documentation you can find online saying to use '^' only applies to Windows's cmd.exe! It is immensely annoying when people keep repeating this as advice for DOS - and no doubt this style of confident-but-wrong responses will only get more frequent, since it's basically what ChatGPT does as well...

DOS doesn't have any way to quote special characters.

You can use the codepage 437 line drawing characters by holding down the Alt key and typing their (decimal) numbers:

Code:
Alt+179 = │
Alt+196 = ─

Alt+218 = ┌
Alt+191 = ┐

Alt+192 = └
Alt+217 = ┘

echo ┌─────────────┐
echo │Text in a box│
echo └─────────────┘
 
Alright! Thanks for all the help. I'm attaching the BAT file (as a txt) for convenience, but the ^ idea didn't work. I wrote the file in Windows 10 and then transferred it to my CF card, but I am aware of using the alt codes, I'm just not a fan of edlin though...
 

Attachments

  • AUTOEXEC.TXT
    699 bytes · Views: 7
Or, if you want to use a tiny utility, here's one that I wrote long ago to handle the problem of special characters not easily inserted into an "echo" statement.

For example, "eco This is a bar \179"

Mind you, I penned this utility 35 or so--well, almost 40 years ago. Nihil sub sole novum.
 

Attachments

  • eco.zip
    1.1 KB · Views: 2
Last edited:
By the way, the same Alt+Numpad codes probably still work in Windows 10 (I know they do in Win7).

It translates the DOS character codes to Unicode codepoints, to use Unicode directly you type a leading zero. The only problem would be saving the file in the correct codepage - Notepad++ should be able to handle it, I think?
 
All the documentation you can find online saying to use '^' only applies to Windows's cmd.exe! It is immensely annoying when people keep repeating this as advice for DOS - and no doubt this style of confident-but-wrong responses will only get more frequent, since it's basically what ChatGPT does as well...
I will admit that I *should* have tested it on my DOS machine before I posted and I didn't and I was wrong. I will apologize to the OP for the misinformation.
 
By the way, the same Alt+Numpad codes probably still work in Windows 10 (I know they do in Win7).

It translates the DOS character codes to Unicode codepoints, to use Unicode directly you type a leading zero. The only problem would be saving the file in the correct codepage - Notepad++ should be able to handle it, I think?
At one point I thought it was because the file was saving as UTF-8 and not ANSI (it didn’t work). What would I have to do in notepad++ to save it differently?
 
Back
Top