1.

Solve : Echo and set?

Answer»

hello. i need to now how to make a code like this:

hello whats your name?
then when i type tex kvasten
Oh! hello kvasten!


can someone tell me how to do it?
Sounds like

(1) You already know, nearly (see your title)
(2) This is your homework.

We don't do people's homework for them, because homework has a purpose, to help you learn.

Study echo and set. Do this by typing echo /? and set /? at the prompt, and READING what you see.



Yes this is really simple and could be done in just three or four lines of code. Though, if you need it to be as in your example and take the second section of a " " delimited name then you'll also need a for loop.DS, I noticed that too. I think that is due to CARELESS typing rather than a requirement in what the teacher set for the assignment. I could be wrong.

Homework is for noobs ... I can't actually imagine a school that TEACHES batch programming ? It can have very damaging implications if used incorrectly, especially if they are ENCOURAGED to 'experiment' at home, what would happen if they screwed over their home computer ?Quote from: DeltaSlaya on August 31, 2007, 04:34:26 AM

I can't actually imagine a school that teaches batch programming ?

Plenty of community colleges and introductory Comp Sci courses use batch, QBasic etc as introductions to programming concepts.
I can't imagine why when a poster comes here for information, people find a need to editorialize about homework and such. Whether people learn from a book or each other, it's STILL learning. The OP never said a word about homework.

Code: [Select]@echo off
set /p name=What is your name?
for /f "tokens=1-2" %%i in ("%name%") do (
echo Oh! hello %%j
)

Many people find that providing ready-made batch files to people, who display little or no interest in the coding issues, for work or school purposes is not why they contribute to help forums.
Quote from: Sidewinder on August 31, 2007, 07:41:36 AM
The OP never said a word about homework.

They seldom do


Discussion

No Comment Found