Skip to content
Permalink
Browse files

Create enterNumber.bat

  • Loading branch information...
npocmaka committed Apr 8, 2019
1 parent a5fd9a5 commit 8a1b6e185058ed9b8eb3cc7dbc2b7cfe4dbfd85a
Showing with 21 additions and 0 deletions.
  1. +21 −0 hybrids/.net/powershell/enterNumber.bat
@@ -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.
You can’t perform that action at this time.