Either single or double should work. The main difference is double qoutes will attempt to expand variables and single qoutes are literal:
PS C:\WINDOWS\system32> $test = "a zombie"
PS C:\WINDOWS\system32> "Rob was chased by $test"
Rob was chased by a zombie
PS C:\WINDOWS\system32> 'Rob was chased by $test'
Rob was chased by $test
I’m not sure I follow your question. Are you saying the variable name has spaces or your variable has a value <string> with spaces in it? For information on naming variables look here. Bottom line to have spaces in a variable name you would place it in curly braces like this.
${hello world} = "Some text"
String literals with spaces should be in quotes. Single quotes are literal and double-quotes can interpolate. You can read more about that here.
If you post your actual code I might be able to help you further.
ForEach-Object ($job in “‘$jobs’”)
{
Get-VBRJobObject -Name $job
}
here is the list of items that I’m passing from a cmdlet as you can see most of the list has spaces. What I’m really trying to accomplish is to pass this data to another cmdlet however it fails. I wonder if I have to split each item in the list into a separate item (not sure how to do that) because it still fails when I put the vatiable in quotes i.e “$jobs”.