Home > PowerShell > Tip: How to find variable type in PowerShell

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..

No related content found.

Categories: PowerShell Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>