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?

Samantha J T Star
  • 30,952
  • 84
  • 245
  • 427
  • possible duplicate of [Echo equivalent in PowerShell for script testing](http://stackoverflow.com/questions/707646/echo-equivalent-in-powershell-for-script-testing) – Vesper Jul 23 '15 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. – Vesper Jul 23 '15 at 11:24

1 Answers1

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.

Keith Hill
  • 194,368
  • 42
  • 353
  • 369