Skip to content

Commit

Permalink
Create enterNumber.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
npocmaka committed Apr 8, 2019
1 parent a5fd9a5 commit 8a1b6e1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions hybrids/.net/powershell/enterNumber.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<# : batch portion
@echo off & setlocal

for /f "tokens=*" %%a in ('powershell -noprofile "iex (${%~f0} | out-string)"') do set "number=%%a"
echo you've entered %number%

endlocal
goto :EOF

: end batch / begin powershell #>

do {
[Console]::Error.Write("Enter a number:")
$inputString = read-host
$value = $inputString -as [Double]
$ok = $value -ne $NULL
if ( -not $ok ) {[Console]::Error.WriteLine("You must enter a numeric value") }
}
until ( $ok )

write-host "$value"

0 comments on commit 8a1b6e1

Please sign in to comment.