Copy file with square brackets [ ] in the filename and use * wildcard

后端 未结 9 1456
迷失自我
迷失自我 2020-12-08 22:35

I\'m using PowerShell on Windows 7, and writing a script to copy a bunch of files from one folder structure to another. Kind of like compiling. The PowerShell Copy-I

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 23:11

    There's a difference between ' and `:

    • The first is the single quote that is the non-shift character on the " key.
    • The second is the backtick that I thought I was using but actually wasn't. It's the nonshift character on the ~ key.

    This works:

    # to Fusion Server
    Copy-item -Path $FSG\$SW\0.RoomView.Notes\starter\'``[RoomView``] Versions explained*.pdf' -Destination $FSG\$containerFolder\$rootFolder\"Fusion Server"\
    

提交回复
热议问题