PowerTip: Create Empty String with PowerShell

PowerTip: Create Empty String with PowerShell

  • Comments 6
  • Likes

Summary: Learn how to create an empty string by using Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to create an empty string?

Hey, Scripting Guy! Answer Use the static Empty field from the System.String class:


Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • What about $string = ""

  • @Maekee sure, that works as well. With PowerShell, there is always more than one way to do the same thing.

  • Thankful concerning such an unprecedented article here. I was chasing down something like this for really truly a while lastly I've ran across it on your site. It was unquestionably captivating for me to I read about web applications and their business segment condition nowadays. tremendously liked one all the more a chance and keep posting such charming ones in the closest future too. http://buysoundcloudnow.com/plays/">how to buy soundcloud plays

  • Are there situations where you'd want to use [string]::Empty over $string = ""? Or do they accomplish the exact same thing?

  • thank you