title: Discouraged dealing with spaces in path strings with PowerShell
body: <p>I have this piece of code that basically checks if one or more files exist. It works when I search for one file, but it doesn't when I try to search for more. I tried to define an array that takes a string of the path of the file to look for, and then check its existence. But I noticed because there is a space in the path, it won't work. I tried all the combinations I could with simple quotes, double quotes, escaping quotes, nothing...</p>
  
  <p>I don't want to create a specific function for that, just to make things work, keep it simple. Could you please help ?</p>
  
  <p>EDIT : to make the script work, add this : $LogSb = new-object System.Text.StringBuilder
  and you might want to add some output because by default everything goes silently into a "log" string builder.</p>
  
  <pre><code>##Checkink files containing my functions
  #
  $Fonctions = "C:\Program Files\scheduler\jobs\SuivideProd\OLAP\PlusProchesVoisins.ps1", "C:\Program Files\scheduler\jobs\SuivideProd\OLAP\OrdreProcess.ps1"
  #Tried something like this before, same error :
  #$Fonctions = @()
  #$Fonctions += "C:\'Program Files'\scheduler\jobs\SuivideProd\OLAP\PlusProchesVoisins.ps1"
  #$Fonctions += "C:\'Program Files'\scheduler\jobs\SuivideProd\OLAP\OrdreProcess.ps1"
  foreach ($fonc in $Fonctions) {
    if ((Test-Path $fonc) -eq $True) {
      [void]$LogSb.append("`n").appendline($("Le fichier contenant la fonction $(split-path $fonc -Leaf) a été trouvé."))
      #dot source the file if existing
      . $Fonctions
    } else {
      [void]$LogSb.append("`n").appendline($("Le fichier contenant la fonction $fonc n'a pas été trouvé."))
      throw ("Le fichier contenant la fonction $(split-path $fonc -Leaf) n'a pas été trouvé")
    }
  }
  </code></pre>