Techibee.com

Tip: How to find variable type in PowerShell

We use variables in powershell without declaring them. That is so nice and eases the programming. But what to do when you really want to know what is the variable type that got created? We can’t go by evaluating the value assigned to the variable but there is a simple way the *Power*Shell.

"Hallo".GetType().FullName            

(4).GetType().FullName            

(2.6).GetType().FullName            

(Get-Date).GetType().FullName

If $myvariable is the one you are using, then just try $myvariable.gettype().fullname

Hope this tiny tip helps you..happy learning..

Exit mobile version