- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the variable data type in PowerShell?
There are different data types exist for the variable like Byte, Int32, Float, String, etc. To get the variable type, we need to use the GetType() method.
Example
$x = 10 $x.GetType()
Output
IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Int32 System.ValueType
To get only the variable datatype use Name property.
$x.GetType().Name
Int32
- Related Articles
- How to get environment variable value using PowerShell?
- How to get services based on start-type in PowerShell?
- How to convert the Integer variable to the string variable in PowerShell?
- How to get the Azure VM storage account type using PowerShell?
- Get the type of a variable in MySQL?
- How to use the ErrorActionPreference variable in PowerShell?
- How to get the data type of a tensor in PyTorch?
- How to get all the aliases in PowerShell?
- How to get the data type name from the java.sql.Type code using JDBC?
- How to use sizeof() operator to find the size of a data type or a variable in C#
- How to get the readonly files using Get-ChildItem in PowerShell?
- How to get the system files using the Get-ChildItem in PowerShell?
- How to get all the Get-Process properties using PowerShell?
- How to get the System uptime with PowerShell?
- How to get the disk information using PowerShell?

Advertisements