Collections:
Other Resources:
What Is String in Windows PowerShell
What is a string in Windows PowerShell?
✍: FYIcenter.com
A string is a sequence of characters in Windows PowerShell.
If a sting is encoded in ASCII format, each character occupies a single byte. But if a string is encoded in UTF-8 format, a character may occupy multiple bytes. So the number of characters in a string may not be equal to the number of bytes.
In most cases, characters can be entered directly by pressing a key on the keyboard. But special characters or multiple-byte characters require escape sequences to enter them. Windows PowerShell supports the following escape sequences:
`` - The ` character `t - The tab character `n - The new line character `r - The carriage return character `' - The single quote character `" - The double quote character `$ - The dollar sign character
Strings can be entered in PowerShell command lines and scripts as String literals in two formats:
Here is a script with some example of string literals in Windows PowerShell:
# A double-quote string literal Write-Host "Hello world!" # A double-quote string literal with an escape sequence Write-Host "Line 1 `n Line 2" # A single-quote string literal Write-Host 'Line 1 `n Line 2' # A single-quote string literal Write-Host 'Let''s go!'
If you run the script, you will get:
PS C:\fyicenter> Test.ps1 Hello world! Line 1 Line 2 Line 1 `n Line 2 Let's go!
⇒ String Concatenation in Windows PowerShell
⇐ Work with Strings in Windows PowerShell
2016-10-20, 1834🔥, 0💬
Popular Posts:
Can I remove startup application "ISUSPM.exe - InstallShield Update Service Update Manager" to speed...
How to remove realsched.exe from the startup application list to gain performance and reduce securit...
How to download and install Alexa Toolbar for Internet Explorer (IE) 7 browser? Alexa Toolbar offers...
How to remove AcroIEHelper.dll - Adobe Acrobat IE Helper Version 6.0 for ActiveX? DLL AcroIEHelper.d...
What is "Health Key and Certificate Management" in my Windows XP service list? And how is "Health Ke...