- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 retrieve the content of the file in PowerShell?
To retrieve the content of the file in PowerShell, you need to use Get-Content cmdlet. For example, we are going to retrieve the content of the text file called Aliases.txt from a specific location.
Example
Get-Content D:\Temp\aliases.txt
Output
PS C:\WINDOWS\system32> Get-Content D:\Temp\aliases.txt # Alias File # Exported by : admin # Date/Time : 26 January 2020 19:20:24 # Computer : DESKTOP-9435KM9 "foreach","ForEach-Object","","ReadOnly, AllScope" "%","ForEach-Object","","ReadOnly, AllScope" "where","Where-Object","","ReadOnly, AllScope" "?","Where-Object","","ReadOnly, AllScope" "ac","Add-Content","","ReadOnly, AllScope" "clc","Clear-Content","","ReadOnly, AllScope" "cli","Clear-Item","","ReadOnly, AllScope" "clp","Clear-ItemProperty","","ReadOnly, AllScope" "clv","Clear-Variable","","ReadOnly, AllScope" "compare","Compare-Object","","ReadOnly, AllScope" "cpi","Copy-Item","","ReadOnly, AllScope" "cpp","Copy-ItemProperty","","ReadOnly, AllScope" "cvpa","Convert-Path","","ReadOnly, AllScope" "dbp","Disable-PSBreakpoint","","ReadOnly, AllScope" "diff","Compare-Object","","ReadOnly, AllScope" "ebp","Enable-PSBreakpoint","","ReadOnly, AllScope" "epal","Export-Alias","","ReadOnly, AllScope" "epcsv","Export-Csv","","ReadOnly, AllScope" "fc","Format-Custom","","ReadOnly, AllScope" "fl","Format-List","","ReadOnly, AllScope" "ft","Format-Table","","ReadOnly, AllScope" "fw","Format-Wide","","ReadOnly, AllScope" "gal","Get-Alias","","ReadOnly, AllScope" "gbp","Get-PSBreakpoint","","ReadOnly, AllScope" "gc","Get-Content","","ReadOnly, AllScope"
You can also retrieve the content of the file from the remote location.
For example,
Get-Content \Test-PC\Shared\Powershellaliases.txt
- Related Articles
- How to retrieve CSV file headers using PowerShell?
- How to retrieve specific file(s) information using Get-ChildItem in PowerShell?
- How to list the directory content in PowerShell?
- How to clear the content of the recycle bin in PowerShell?
- How to retrieve the Operating system of the Azure VM using PowerShell?
- How to retrieve the OS of the Azure VM using Azure CLI in PowerShell?
- How to detect the content type of a file in Golang?
- How to search in the file using PowerShell?
- How to read the XML file in PowerShell?
- How to retrieve the Azure VM resource group using PowerShell?
- How to retrieve the Azure VM Subscription Name using PowerShell?
- How to retrieve the Azure VM NIC name using PowerShell?
- How to retrieve the Azure VM vNet name using PowerShell?
- How to retrieve the MSI package product code using PowerShell?
- How to retrieve the Azure VM deallocated date using PowerShell?

Advertisements