Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a trivia script, how would you enter a fill in the blank question and an answer like the Seinfeld trivia game in Programming for Beginners?

share|improve this question
What have you tried? What concepts have you learned so far? It doesn't help you for someone to just provide the answer; show us what you've tried and where you're stuck, and people will be more willing to give helpful answers. – Stephen Jennings Nov 2 '10 at 5:46

There is the Read-Host cmdlet for reading input from the user, and you'll need some conditional logic to check against the correct answer.

share|improve this answer

As well as Read-Host you can directly use the System.Console class, to read a single character (without needing ENTER):

$key = [Console]::ReadKey()
$char = $key.KeyChar
share|improve this answer
#Ask the player the eighth question While ($question8 -eq "George"){ Clear-Host #clear the windows command console screen write-Host Write-Host "Fill in the blank" Write-Host Write-Host "_______is attacked by a hawk." Write-Host $question8 = Read-Host " Fill in the blank with the correct name" ` "and press the Enter key" } #Clear the Windows command console screen Clear-Host – Colby Ellsworth Nov 2 '10 at 22:02
This is what I have tried but no luck I have made some changes to it but can not figure out what I need to impute to get it to work – Colby Ellsworth Nov 2 '10 at 22:04
@Colby: Please edit the question to include further information (and from the code I expect you needed -neq (not equals) in the while condition). – Richard Nov 3 '10 at 8:25
#Ask the player the seventh question
while (($question7 -eq "")) {

  Clear-Host  #Clear the Windows command console screen

  Write-Host " What food item did Jerry say Newman wouldn't eat even if it was deep fried in chocolate sauce?"
  Write-Host " Broccoli"
  Write-Host " Peas"
  Write-Host " Apples"
  Write-Host " Carrots"
  $question7 = Read-Host " Type the word representing the correct answer" `
    "and press the Enter key"

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.