Quantcast
Channel: Scripting Blog
Viewing all articles
Browse latest Browse all 2129

PowerTip: Capture the output of a Linux application in PowerShell

$
0
0

Summary: Use the built-in features of PowerShell to obtain data produced by a Linux application.

Hey, Scripting Guy! Question Can I run a Linux application like ls and capture its output in PowerShell?

Hey, Scripting Guy! Answer You certainly can!  It’s no different from when you normally grab output from any other command in Windows.   To grab the output of the ls command, for example, just assign it to a PowerShell object as you normally would.

$stuffonscreen=(ls)

The captured output will be all text, and you can run standard methods, Search-String and regular expressions against it.

The Doctor


Viewing all articles
Browse latest Browse all 2129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>