0

I have tried this:

# Set-ExecutionPolicy Unrestricted
$VerbosePreference = 'Continue'
Write-Verbose "ABC"
$DebugPreference = "Continue"
Write-Debug "Something went wrong."

But both messages come either with the word: VERBOSE or DEBUG before the actual message.

Is there a way I can just display the message content only?

2
  • possible duplicate of Echo equivalent in PowerShell for script testing Commented Jul 23, 2015 at 11:24
  • 2
    You can just output a string: "ABC" Or, if you insist that a cmdlet would be used, use Write-Host or Write-Default. See linked question for details. Commented Jul 23, 2015 at 11:24

1 Answer 1

1

Write-Host is what you would use to write a message to the host. Note that in V4 and below, you can't capture this sort of output to a log file. Starting with V5, you can capture host messages because Write-Host has been updated to use the new Information stream. Likewise in V5, you could just use Write-Information directly.

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

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.