Welcome and questions

Convert your BATch files into EXEcutable format in one click.
Post Reply
SonicARG
Posts: 1
Joined: Tue Feb 17, 2009 1:06 am

Welcome and questions

Post by SonicARG »

Hello everyone! I'm SonicARG and I want to say hello to all people in this forum. I hope I can solve all my problems and meet mates here.
Before I begin, I have to tell you I'm from Argentina ( :P if you haven't noticed that...) so maybe I'll have some bad writing; don't bother: I'm an English learner, I can make mistakes... :lol:
Well, let's get back to the point: help me! :lol:
I wanted to know if these situations are possible for batches:
:arrow: 1. Is it possible for a batch to write the content of a file (supposing <=2kB) in the screen?
:arrow: 2. I know that batch variables can be stored in files, but is it possible that a variable can be set from the content of a file? See this example:
Supose I'm doing a game I need record hiscores. I got the file bestscore.num (*.num to remind me I'm introducing a number) and I got bestscore.str (*.str to remind me I'm introducing a text string). I want the file, when I ask it to show this data. How do I do it?
Supose I want to write ECHO Today's High Score: %hiscorename% who made %hiscore% points. (Please note that hiscorename=bestscore.str and hiscore=bestscore.num)
:arrow: 3. Is it possible for a batch to do the same action as before but with the *.ini style?
Taking back the last example, I got bestscore.ini instead of the two files. Inside it, I got:

HiScore=10000
HiScoreName=Machine

Is it possible for a batch to read the variable after the "="? (Go to Line 1, Column 8 and read %hiscore% and so on?)
:arrow: 4. Is it possibe for a batch to write ASCII characters both ofr the screen and for files? (for example: char 1 = &#9786;, char 2 = &#9787;, and so on) How can be implemented it?

That are my questions by now. Hope you can help me!
Thanks!
SonicARG

///EDIT MESSAGE///
Problems 2 & 3 were solved: I got several programs that solved them and helped me a lot. Just have a look at http://www.fpschultze.de/ for loads of programs ready for DOS.
Thanks anyway! I'm still waiting for #1 & #4.
SonicARG
support
Site Admin
Posts: 476
Joined: Fri Feb 13, 2004 1:05 pm

Post by support »

Just a quick answers:

1. TYPE file.txt
2. SET /P VAR=string <file.txt
blasch
Posts: 3
Joined: Thu Sep 03, 2009 6:44 pm

Post by blasch »

Support has answered question 1

here is question 4.

you need to determine the dos code page of the characters you wish to print or sent to a file.

the two in your example are found in the dos standard code page 437.

you can determine which code page is active in your shell by issuing the chcp command

you will get something like this

C:\>chcp
Active code page: 437

to print characters in your examples you will need to enter a special series of 4 numbers on your computer's number pad while holding the alt key down to express the character, which I'll express thusly {alt+0001} which translates to hold the ALT key and type 0001 on your number pad. Depending on the shell or text editor you might see a funky text or no text at all, then press enter or save the file as a batch and run to test.

for char 1 = &#9786;
in your shell or text editor issue the following command
echo {alt+0001}

for
char 2 = &#9787;
in your shell or text editor issue the following command
echo {alt+0002}
Post Reply