40

This seems like something that should be painfully obvious, but for whatever reason I can't figure it out. From within powershell, I'd like to be able to print the contents of a text file to the host window (or pipe it into another command). I'm looking for something like this:

PS C:\> {some command} README.TXT
These are the contents of the Readme.txt file!

3 Answers 3

64

You are looking for:

get-content README.TXT

In short:

gc README.TXT

If you are used to cat, you can use that too, it is just an alias for the above in Powershell.

Sign up to request clarification or add additional context in comments.

1 Comment

Or "type". Get-Content, the command so nice they named it twice twice.
4

It exists also :

${full path file}

Ex :

${c:\silogix\t.txt}

1 Comment

Note: Only works with fullpath
1

try it:

get-content .\README.TXT

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.