Page 1 of 1

plus sign in file name

Posted: 12 Jun 2024 03:57
by lazna
Copying some binaries from one directory to another utilizing 'copy' command, but facing issues when filename contain plus sign (in my case libstdc++-6.dll) and is not doublequoted. Probably the copy command misinterprete it as a file combining operation. Searching for any description about this issue, but found nothing... Is this a known issue?

Re: plus sign in file name

Posted: 12 Jun 2024 06:35
by ShadowThief
Not a known issue per se, but a known and expected behavior. This is the very last sentence of copy /? -
To append files, specify a single file for destination, but multiple files for source (using wildcards or file1+file2+file3 format).
Like all other special characters, you'll have to wrap the filename in quotes in order for the plus signs to behave like regular text.

Re: plus sign in file name

Posted: 12 Jun 2024 09:33
by lazna
ShadowThief wrote:
12 Jun 2024 06:35
Not a known issue per se, but a known and expected behavior. This is the very last sentence of copy /? -
To append files, specify a single file for destination, but multiple files for source (using wildcards or file1+file2+file3 format).
Like all other special characters, you'll have to wrap the filename in quotes in order for the plus signs to behave like regular text.
I read this, but there is also list characters disallowed in filenames https://learn.microsoft.com/en-us/windo ... ing-a-file where plus sign is not listed. I wrote this article for another people who may facing this issue, and did not came to their mind the plus sign inde of filename automatically turn on file appending function unintendly.

BTW: What about to extend this page https://ss64.com/nt/copy.html by notice "in case name some of your files could contain plus sign, enclose it with doublequotes" or something like this??

Re: plus sign in file name

Posted: 12 Jun 2024 11:05
by Squashman
Don't use COPY. Use XCOPY or ROBOCOPY.

Re: plus sign in file name

Posted: 12 Jun 2024 21:14
by ShadowThief
lazna wrote:
12 Jun 2024 09:33
ShadowThief wrote:
12 Jun 2024 06:35
Not a known issue per se, but a known and expected behavior. This is the very last sentence of copy /? -
To append files, specify a single file for destination, but multiple files for source (using wildcards or file1+file2+file3 format).
Like all other special characters, you'll have to wrap the filename in quotes in order for the plus signs to behave like regular text.
I read this, but there is also list characters disallowed in filenames https://learn.microsoft.com/en-us/windo ... ing-a-file where plus sign is not listed. I wrote this article for another people who may facing this issue, and did not came to their mind the plus sign inde of filename automatically turn on file appending function unintendly.
Only the copy command will break with plus signs, whereas all commands break with those other listed characters
lazna wrote:
12 Jun 2024 09:33
BTW: What about to extend this page https://ss64.com/nt/copy.html by notice "in case name some of your files could contain plus sign, enclose it with doublequotes" or something like this??
Nobody here controls that page, but you're welcome to post your suggestion on that site's forum. I don't know how likely the change will happen given that plus signs are clearly visible in the usage text indicating that they have special significance and the number one rule of interacting with any filenames is "put quotes around everything," but the owner is usually fairly open to recommendations.