Show message if a particular word is typed

Asked

Viewed 51 times

2

How do I get someone to write on cmd:

> tree 

A message appears using the following command:

Console.Write("");
  • 2

    What is the purpose of this writing?

  • 1

    The obejective is that when you write Tree a message appears

  • 2

    Is that it? It’s not just a case of creating a Console Application calling for tree?

  • 2

    I will make a joke with friends and I needed to do when writing Tree in cmd appear repeatedly in cmd virus not found

1 answer

3


You can use Console.ReadLine():

string entrada = Console.ReadLine();
if (entrada == "tree"){
    Console.WriteLine("Mensagem!");
}
  • 1

    Thanks for the help :D I have to wait 5 minutes to put as the right answer

Browser other questions tagged

You are not signed in. Login or sign up in order to post.