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
$tentative=1
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 ?"
$tentative++
}
Write-OutPut ""
Write-Output "Vous avez gagné, le nombre mistère était bien:" $Random "En $tentative coups !"
Read-Host
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.