Asked by:
read file into variable

Question
-
i am using ps v1.0 (at a client site) i need to read a html file into a variable
Get-Content "File Name" | Out-String
how do i convert Out-String to a variable that i can use?
thx 4 ur help
y zidell
Monday, March 16, 2020 9:40 PM
All replies
-
Have you at least tried to search for this? It would have taken you seconds to find the answer.
$variable = Get-Content "File Name"
Live long and prosper!
(79,108,97,102|%{[char]$_})-join''
- Proposed as answer by Yang YoungMicrosoft contingent staff Tuesday, March 24, 2020 1:50 AM
Monday, March 16, 2020 9:44 PM -
There is no such animal as PS v1. Maybe you are running Windows XP with a first version of PowerShell.
Here is an excellent free book (pdf) on how to use PowerShell. The first chapter will answer most of your initial questions in less thna an hour.
https://www.sapien.com/books_training/Windows-PowerShell-4
\_(ツ)_/
Monday, March 16, 2020 9:51 PM -
Hi,
Was your issue resolved?
If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
If no, please reply and tell us the current situation in order to provide further help.
Best Regards,
Yang Yang
Tuesday, March 24, 2020 1:50 AM -
Hi,
Was your issue resolved?
If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
If no, please reply and tell us the current situation in order to provide further help.
Best Regards,
Yang Yang
Monday, March 30, 2020 5:58 AM