Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Question on int32 and read-host

$
0
0

Got a wierd issue but I'm sure someone can answer me:

So the following powershell is used:

$a = 20mb
$a.gettype() outputs an int32

BUT

If I do a read-host, example below:

$b = read-host
20mb

$b.gettype() outputs a string

So then I try the following:

[int]$d = read-host
20mb

Then I receive a "Cannot convert value "20mb" to type "System.Int32""

Can anyone tell me how to use read-host to create an int32 for the read in value 20mb?

Thanks in advance.

Dave


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>