How can i disable letters and special characters from my script?

Firstly i’m in formation and i have to create a simple PowerShell script.
So i have create a script about the magical number. My script generate a random number between 0 and 100 and the user have to find him. At any answer the script tell to the user if the number are bigger or smaller.

write-Output "Le nombre Mystère est compris entre 0 et 100"
$variable=Read-Host "Quel est le nombre mystère ?" 
$Random=Get-Random -minimum 0 -maximum 100 

While ($variable -ne $random) { 
    if ($variable -lt $Random) {Write-Output "C'est plus!"} 
    if ($variable -gt $Random) {Write-Output "C'est moins"} 

$variable=Read-Host "Quel est le nombre mystère ?" 

Write-OutPut ""
Write-Output "Vous avez gagné, le nombre mistère était bien:" $Random "En $tentative coups !"

and now i want to disable all the letters and the special charaters from any answer by the user and i don’t know how to do that.

Welcome to the forum. :wave:t4:

$Start = 0
$End = 100

$choice = 0
do {
    try {
        [int]$choice = Read-Host "`nPlease enter a number between $Start and $End"  -ErrorAction Stop
    catch {
        Write-Warning "Incorrect input! Please enter a number between $Start and $End!"
until ($choice -gt $Start -and $choice -lt $End )
return $choice

Perfect, exactly what i want.
Thank you Olaf. :grinning: