| View previous topic :: View next topic |
| Author |
Message |
SonicARG
Joined: 17 Feb 2009 Posts: 1
|
Posted: Wed Feb 18, 2009 5:27 pm Post subject: Welcome and questions |
|
|
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 ( 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...
Well, let's get back to the point: help me!
I wanted to know if these situations are possible for batches:
1. Is it possible for a batch to write the content of a file (supposing <=2kB) in the screen?
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:
| Quote: | 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) |
3. Is it possible for a batch to do the same action as before but with the *.ini style?
| Quote: | 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?) |
4. Is it possibe for a batch to write ASCII characters both ofr the screen and for files? (for example: char 1 = ☺, char 2 = ☻, 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 |
|
| Back to top |
|
 |
|
|
support Site Admin
Joined: 13 Feb 2004 Posts: 299
|
Posted: Mon Mar 16, 2009 10:55 pm Post subject: |
|
|
Just a quick answers:
1. TYPE file.txt
2. SET /P VAR=string <file.txt |
|
| Back to top |
|
 |
blasch
Joined: 03 Sep 2009 Posts: 3
|
Posted: Thu Sep 03, 2009 7:56 pm Post subject: |
|
|
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 = ☺
in your shell or text editor issue the following command
echo {alt+0001}
for
char 2 = ☻
in your shell or text editor issue the following command
echo {alt+0002} |
|
| Back to top |
|
 |
|