Files with spaces passed to PowerShell script not found RRS feed

  • Question

  • When I run the powershell script below, it complains that this file cannot be found: C:\Users\bernie\Photo.  I've tried all sorts of quoting, using &, nothing seems to work.  How can I reference this file in the script snippet below:

    C:\Users\bernie\Photo Staging\tmp\DSC_1034 - Copy.JPG

    param([String[]] $jpgfiles)

    foreach ($jpgfile in $jpgfiles) {

        $file = Get-Item $jpgfile



    Saturday, October 20, 2018 2:06 AM