PC Review


Reply
Thread Tools Rate Thread

cannot copy file using xcopy, that has a % in the file name

 
 
=?Utf-8?B?cm1hYw==?=
Guest
Posts: n/a
 
      9th Oct 2006
Running XpSp2, fully patched. I am trying to copy a file that has a '%'
symbol in it ( say the file name is: #$%3fw.txt) and using xcopy from a batch
file and it will not copy. I get a message back that file #$fw.txt is not
found. There are no spaces in the UNC path to the file and it does not matter
if the path is in double or single quotes.

The strange thing, is if I take it out of the batch file and just copy it
into an existing command shell, it copies fine. So what is the difference
from using xcopy from a batch file compared to a command shell?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGFwYURvcw==?=
Guest
Posts: n/a
 
      9th Oct 2006
You need to double the %.
If your file is named "#$%3fw.txt", use "#$%%3fw.txt" to avoid the
"environment variable replacement" confusion...
--
Festina Lente


"rmac" wrote:

> Running XpSp2, fully patched. I am trying to copy a file that has a '%'
> symbol in it ( say the file name is: #$%3fw.txt) and using xcopy from a batch
> file and it will not copy. I get a message back that file #$fw.txt is not
> found. There are no spaces in the UNC path to the file and it does not matter
> if the path is in double or single quotes.
>
> The strange thing, is if I take it out of the batch file and just copy it
> into an existing command shell, it copies fine. So what is the difference
> from using xcopy from a batch file compared to a command shell?

 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      10th Oct 2006
I think the OP needs to escape the % character rather
than doubling it:

xcopy c:\#$^%3fw.txt d:\

"PapaDos" <(E-Mail Removed)> wrote in message
news:49A2E75B-0515-4E11-9963-(E-Mail Removed)...
> You need to double the %.
> If your file is named "#$%3fw.txt", use "#$%%3fw.txt" to avoid the
> "environment variable replacement" confusion...
> --
> Festina Lente
>
>
> "rmac" wrote:
>
> > Running XpSp2, fully patched. I am trying to copy a file that has a '%'
> > symbol in it ( say the file name is: #$%3fw.txt) and using xcopy from a

batch
> > file and it will not copy. I get a message back that file #$fw.txt is

not
> > found. There are no spaces in the UNC path to the file and it does not

matter
> > if the path is in double or single quotes.
> >
> > The strange thing, is if I take it out of the batch file and just copy

it
> > into an existing command shell, it copies fine. So what is the

difference
> > from using xcopy from a batch file compared to a command shell?



 
Reply With Quote
 
=?Utf-8?B?cm1hYw==?=
Guest
Posts: n/a
 
      10th Oct 2006
Thanks for the information, but I cannot remove the % from the file name, and
changing the file name may not be the best option for me in this case.

"Pegasus (MVP)" wrote:

> I think the OP needs to escape the % character rather
> than doubling it:
>
> xcopy c:\#$^%3fw.txt d:\
>
> "PapaDos" <(E-Mail Removed)> wrote in message
> news:49A2E75B-0515-4E11-9963-(E-Mail Removed)...
> > You need to double the %.
> > If your file is named "#$%3fw.txt", use "#$%%3fw.txt" to avoid the
> > "environment variable replacement" confusion...
> > --
> > Festina Lente
> >
> >
> > "rmac" wrote:
> >
> > > Running XpSp2, fully patched. I am trying to copy a file that has a '%'
> > > symbol in it ( say the file name is: #$%3fw.txt) and using xcopy from a

> batch
> > > file and it will not copy. I get a message back that file #$fw.txt is

> not
> > > found. There are no spaces in the UNC path to the file and it does not

> matter
> > > if the path is in double or single quotes.
> > >
> > > The strange thing, is if I take it out of the batch file and just copy

> it
> > > into an existing command shell, it copies fine. So what is the

> difference
> > > from using xcopy from a batch file compared to a command shell?

>
>
>

 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      10th Oct 2006
Use wildcards!

BTW: I was wrong with my escape character (because
I only tested it in a Command Prompt environment). In
a batch file the suggestion made by PapaDos is the
correct way to resolve the problem.

"rmac" <(E-Mail Removed)> wrote in message
news:F785D571-5B6F-40EC-9B24-(E-Mail Removed)...
> Thanks for the information, but I cannot remove the % from the file name,

and
> changing the file name may not be the best option for me in this case.
>
> "Pegasus (MVP)" wrote:
>
> > I think the OP needs to escape the % character rather
> > than doubling it:
> >
> > xcopy c:\#$^%3fw.txt d:\
> >
> > "PapaDos" <(E-Mail Removed)> wrote in message
> > news:49A2E75B-0515-4E11-9963-(E-Mail Removed)...
> > > You need to double the %.
> > > If your file is named "#$%3fw.txt", use "#$%%3fw.txt" to avoid the
> > > "environment variable replacement" confusion...
> > > --
> > > Festina Lente
> > >
> > >
> > > "rmac" wrote:
> > >
> > > > Running XpSp2, fully patched. I am trying to copy a file that has a

'%'
> > > > symbol in it ( say the file name is: #$%3fw.txt) and using xcopy

from a
> > batch
> > > > file and it will not copy. I get a message back that file #$fw.txt

is
> > not
> > > > found. There are no spaces in the UNC path to the file and it does

not
> > matter
> > > > if the path is in double or single quotes.
> > > >
> > > > The strange thing, is if I take it out of the batch file and just

copy
> > it
> > > > into an existing command shell, it copies fine. So what is the

> > difference
> > > > from using xcopy from a batch file compared to a command shell?

> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy multiple files into a single file - xcopy? =?Utf-8?B?Sm9ybnlP?= Windows XP General 8 15th Mar 2007 09:03 PM
XCOPY FILE TO COPY MY DOCUMENTS FOLDER hamy Windows XP Basics 3 5th Mar 2006 05:47 PM
copy/xcopy always change modified attribute of file? djc Microsoft Windows 2000 CMD Promt 2 11th Jun 2004 05:38 AM
XCOPY Script to Copy File to Network Connection Karl Burrows Microsoft Windows 2000 5 31st Dec 2003 01:03 AM
XCOPY Script to Copy File to Network Connection Karl Burrows Microsoft Windows 2000 RAS Routing 5 31st Dec 2003 01:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:04 AM.