Computing Staff
  • 0

Windows Alt Codes Not Appearing In Batch.

  • 0

Well, I’ve been trying to make a simple menu, and at this point its just a bunch of echos, it doesn’t even do anything complicated. And it’s not complicated. Or so I thought. When trying to display characters such as (alt+186)(║) or (alt+200)(╚) or (alt+204)(╠), to make a simple visual folder tree, it forces me to save it as Unicode or Unicode big endian or utf8 because the ASCII doesn’t recognize the symbols. So if I continue to save it in ASCII it all turns to dashes and plus signs. If I change it to something else and run it, it simply won’t work. The interesting thing is, if I open command prompt, it does allow me to directly type in the characters, and some of them are even used in the /tree command!! I have searched all over the internet, and below I’ll list everything I’ve tried

Copy the symbols into wordpad (they change to something different) and then copy them back to notepad. Save and run, the symbols should appear.
-Well, when I copy them back out of wordpad they return to normal. 🙁

Add chcp 65001 to the beginning of the code.
– Allright, but then I’m forced to save it as something other than ASCII encoding because ASCII reverts the symbols to pluses and dashes, and it still doesn’t work if I save it in a different encoding.

well how about chcp 1252?
– Nope, same as above 🙁

Share

3 Answers

  1. My code page is set to 437, and my scripts have no trouble with these characters. What editor are you using? I had to use qbasic or debug to insert the characters into the batch. vbscript can also be used to build the characters:
    set fso=createobject(“scripting.filesystemobject”)
    set test=fso.createtextfile(“test”)
    test.write chr(200)+chr(197)
    test.close
    If you “type” test, you should see the ascii-graphics on the screen.
    And/or, cut/paste the following lines using notepad and save the file. Go to command prompt and “type” the file. If you see boxes, then the experiment worked. If it fails, try chcp 437 and try again.

    set L1=ÚÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄ¿
    set L2=ÃÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄ´
    set L3=ÀÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÙ

    I think the problem is whatever editor you’re using. EDIT will show the characters as graphics, but will not, as far as i know, allow their creation. vbscript, BASIC (any), and debug will let you create the characters.

    • 0
  2. Ah, I was just using notepad as an editor. And my chcp is 437 also. I wonder if font has anything to do with it? I did read a little about that on certain sites. Something about the default raster font not being able to display the characters properly.
    Also, I did create the above vbs script and I tried placing it directly into command prompt, but when I opened the vbs or hit enter, the vbs made a file with the characters ÈÅ, and pasting into cmd or running it as a batch did nothing. I’m don’t that was the goal… Also, what was I suposed to do with the set L1=ÚÄÄÄ thingy?
    I just tried using VBS Edit, but seeing as how its used for vbs scripts, not batch, it didn’t work. It couldn’t get past the @echo off when compiling. I’ll search for something different later.

    Well, when I used notepad++ it originally encoded it in utf8 w/o BOM, which I ran and I got a bunch of these: ΓòÖΓöÇΓöÇΓöÇ
    When I encoded it in ASCII the special characters turned into these: ╙───
    and when I ran that I got these again: ΓòÖΓöÇΓöÇΓöÇ
    So to be honest, I haven’t found anything that works. 🙁 Please help if possible!!

    • 0
  3. How, or what did you use, to view the vbs output (test)? If you use notepad, it will look like the capital A with the dot, but if you go to command prompt and use “type”, it will look like graphics: type test
    The L1,L2 stuff is snipped from a calendar batch, used to build the calendar, and if you cut/paste it into a file, (nothing fancy, no utf/unicode/ansi stuff, just plain old text), then “type” the file, it should look like two rows of 7 boxes. Again, it won’t look like that in notepad. To view them as graphics, either “TYPE”, “EDIT”, or ECHO (batch) will show them correctly. (EDIT is not a vbs thing, it is a command included with windows). If, for example, you saved the L1 L2 L3 into a file called boxes, then from prompt, type: TYPE BOXES, or use this batch from prompt:
    for /f “tokens=*” %a in (boxes) do @echo %a
    Now, you can teach me something (which everybody else probably already knows): how to type the graphics at the command prompt, and how to put them into a (notepad) document using alt

    • 0