Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6985937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:44:41+00:00 2026-05-27T18:44:41+00:00

Why is it when I run this command in powershell: $output = (svn stat)

  • 0

Why is it when I run this command in powershell:

 $output = (svn stat) -match '^\?' # which $output is an [object] in this case.

I get this output in the PowerGUI Script Editor Console when viewing the variable $output:

?       Projects\TestProject\Thisisatest.txt
?       Projects\TestProject\Thisisatest - Copy.txt

but when I run this command:

[string] $output = (svn stat) -match '^\?'

I get these results:

?       Projects\TestProject\Thisisatest.txt ?       Projects\TestProject\Thisisatest - Copy.txt

It seems when using [string] it does some type of encoding where it takes away newlines and I’m not sure why?

UPDATED
user978511 here is the the small example code and output

Clear-Host
Set-Location "C:\svn\Development\Projects\TestProjects\build"
$output = (svn stat) -match '^\?'
'$output results'
$output

'$output2 results'
[string] $output2 = (svn stat) -match '^\?'
$output2

Output:

$output results
?       Projects\TestProject\Thisisatest.txt
?       Projects\TestProject\Thisisatest - Copy.txt
$output2 results
?       Projects\TestProject\Thisisatest.txt ?       Projects\TestProject\Thisisatest - Copy.txt

Thanks for anyone that can help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:44:42+00:00Added an answer on May 27, 2026 at 6:44 pm

    When PowerShell casts an array to a single string it converts the members to strings and concatenates them with spaces between each.

    $output2 = [string]::join([environment]::newline, $output) will do what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this command that I run everyday via cron: find /home/get/public_html/videos -daystart -maxdepth
I want to do this: run a command capture the output select a line
I am following this tutorial and I've run the command ruby script\server and successfully
If I run the command in powershell: C:\Get-Website it outputs Name ID State Physical
The Set-ExecutionPolicy command of PowerShell is banned, so I can NOT run like this:
I'm trying to run the get-service command on a remote machine in powershell. After
Lets say I run a powershell command (in my case Group Policy related) but
I was trying to run a powershell script (which I have run before) and
This is a duplicate of https://serverfault.com/questions/102098/powershell-script-showing-commands-run . I thought it would be more appropriate
I am trying to run a external exe from a powershell script. This exe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.