0

我有我需要从一个位置复制到另一个位置的文件列表

输入文件:c:/Unknown/Absolute.txt c:/Unknown/Absolute With Space.txt

如果我尝试使用脚本读取输入文件并对目标目录执行 cp 操作,则会失败,文件 Absolute.txt 会像我想要的那样被复制,但是 Absolute With Space.txt 不会。我将如何实现用空格复制文件名?

4

1 回答 1

3

Space is used as separation character, if you don't want that, use "quotes" or escape the spaces with \_ (where _ is a space). So this should both work:

cp "c:/Unknown/Absolute.txt" "c:/Unknown/Absolute With Space.txt"
cp c:/Unknown/Absolute.txt c:/Unknown/Absolute\ With\ Space.txt
于 2013-11-08T17:28:41.353 回答