Batch File Problem

Archived from groups: microsoft.public.windowsxp.general (More info?)

Have two Windows XP Pro SP2 computers on a workgroup LAN: comp1 and
comp2. Simple networking has been turned off on both. I have a
folder on comp2 shared and a drive letter on comp1 mapped to it. User
access rights were set via Security and tested using Windows Explorer.
In the Windows GUI I can copy files from comp1 to the mapped drive
using Windows Explorer without problem. I create a batch file to
xcopy the same file and when run from the GUI (double clicking) or
from a cmd prompt, it fails. Filenames appear but have 0 bytes.
"Access denied" is returned when trying from the cmd prompt .
However, if i manually copy the file from within the cmd prompt by
simply typing the command it works! I note now, however, that the
batch file is using xcopy and the manual copy used copy. I failed to
test manually using xcopy. Can anyone point me to the problem and how
to solve? Is it as simple as using copy vs xcopy? Tnx es 73!
--
Bob Felton
5 answers Last reply
More about batch file problem
  1. Archived from groups: microsoft.public.windowsxp.general (More info?)

    In article <g7rch1h9jd6tmf1nd3sv43v7ahvv655vac@4ax.com>, Bob Felton
    favored us with...
    > Have two Windows XP Pro SP2 computers on a workgroup LAN: comp1 and
    > comp2. Simple networking has been turned off on both. I have a
    > folder on comp2 shared and a drive letter on comp1 mapped to it. User
    > access rights were set via Security and tested using Windows Explorer.
    > In the Windows GUI I can copy files from comp1 to the mapped drive
    > using Windows Explorer without problem. I create a batch file to
    > xcopy the same file and when run from the GUI (double clicking) or
    > from a cmd prompt, it fails. Filenames appear but have 0 bytes.
    > "Access denied" is returned when trying from the cmd prompt .
    > However, if i manually copy the file from within the cmd prompt by
    > simply typing the command it works! I note now, however, that the
    > batch file is using xcopy and the manual copy used copy. I failed to
    > test manually using xcopy. Can anyone point me to the problem and how
    > to solve? Is it as simple as using copy vs xcopy? Tnx es 73!

    1. I'd like to see the command in the batch file, and the command you
    typed, character for character. I've a string hunch there's something
    different between them besides just copy versus xcopy.

    2. Obviously you'll want to try hand typing the xcopy command at the
    command prompt to see if it works.

    3. Also, check the Windows Help topic "Using batch parameters" for
    all the special character combinations involving %, ~, $, and such.
    If your file name happens to match one of them, that would explain
    the trouble.

    4. That zero-byte output makes me suspicious too. IIRC, if xcopy _or_
    copy can't find an input file it doesn't create an output file at
    all. This sounds more like redirection gone wrong. Are you sure you
    don't have a > or | before your second file name?

    --
    Stan Brown, Oak Road Systems, Tompkins County, New York, USA
    http://OakRoadSystems.com/
    "If there's one thing I know, it's men. I ought to: it's
    been my life work." -- Marie Dressler, in /Dinner at Eight/
  2. Archived from groups: microsoft.public.windowsxp.general (More info?)

    Thanks for your response, Stan. As far as I recall, the only strange
    character used in the command is the ~ for keeping folders/filenames
    to 8-characters. I'll double check tomorrow when I'm back at the
    client for further testing. I'll post back. Thanks, again.


    On Thu, 1 Sep 2005 00:18:35 -0400, Stan Brown
    <the_stan_brown@fastmail.fm> wrote:

    >In article <g7rch1h9jd6tmf1nd3sv43v7ahvv655vac@4ax.com>, Bob Felton
    >favored us with...
    >> Have two Windows XP Pro SP2 computers on a workgroup LAN: comp1 and
    >> comp2. Simple networking has been turned off on both. I have a
    >> folder on comp2 shared and a drive letter on comp1 mapped to it. User
    >> access rights were set via Security and tested using Windows Explorer.
    >> In the Windows GUI I can copy files from comp1 to the mapped drive
    >> using Windows Explorer without problem. I create a batch file to
    >> xcopy the same file and when run from the GUI (double clicking) or
    >> from a cmd prompt, it fails. Filenames appear but have 0 bytes.
    >> "Access denied" is returned when trying from the cmd prompt .
    >> However, if i manually copy the file from within the cmd prompt by
    >> simply typing the command it works! I note now, however, that the
    >> batch file is using xcopy and the manual copy used copy. I failed to
    >> test manually using xcopy. Can anyone point me to the problem and how
    >> to solve? Is it as simple as using copy vs xcopy? Tnx es 73!
    >
    >1. I'd like to see the command in the batch file, and the command you
    >typed, character for character. I've a string hunch there's something
    >different between them besides just copy versus xcopy.
    >
    >2. Obviously you'll want to try hand typing the xcopy command at the
    >command prompt to see if it works.
    >
    >3. Also, check the Windows Help topic "Using batch parameters" for
    >all the special character combinations involving %, ~, $, and such.
    >If your file name happens to match one of them, that would explain
    >the trouble.
    >
    >4. That zero-byte output makes me suspicious too. IIRC, if xcopy _or_
    >copy can't find an input file it doesn't create an output file at
    >all. This sounds more like redirection gone wrong. Are you sure you
    >don't have a > or | before your second file name?

    --
    Bob Felton
  3. Archived from groups: microsoft.public.windowsxp.general (More info?)

    "Bob Felton" <bob123.removethis@fieldtown.net> wrote in message
    news:g7rch1h9jd6tmf1nd3sv43v7ahvv655vac@4ax.com...
    > Have two Windows XP Pro SP2 computers on a workgroup LAN: comp1 and
    > comp2. Simple networking has been turned off on both. I have a
    > folder on comp2 shared and a drive letter on comp1 mapped to it. User
    > access rights were set via Security and tested using Windows Explorer.
    > In the Windows GUI I can copy files from comp1 to the mapped drive
    > using Windows Explorer without problem. I create a batch file to
    > xcopy the same file and when run from the GUI (double clicking) or
    > from a cmd prompt, it fails. Filenames appear but have 0 bytes.
    > "Access denied" is returned when trying from the cmd prompt .
    > However, if i manually copy the file from within the cmd prompt by
    > simply typing the command it works! I note now, however, that the
    > batch file is using xcopy and the manual copy used copy. I failed to
    > test manually using xcopy. Can anyone point me to the problem and how
    > to solve? Is it as simple as using copy vs xcopy? Tnx es 73!
    > --
    > Bob Felton

    There is no difference between running a command from the
    Command Prompt or running it inside a batch file. Your
    problem is caused by something else that is not apparent
    from your post. To find out what it is, run these simple tests:

    1. From a Command Prompt, type the copy command that
    works, e.g.

    copy "c:\Some Folder\Some Subfolder\Some File.doc" x:\Docs

    2. Now type type command from the Command Prompt:

    echo copy "c:\Some Folder\Some Subfolder\Some File.doc" x:\Docs >
    c:\test.bat
    (this is one long line!).

    3. Now type this from the Command Prompt:

    c:\test.bat

    I bet that it works! Conversely, do the same thing with your
    original failing batch files: Retype its xcopy.exe command verbatim
    on the Command Line. It will fail too!

    If you still have a problem, post ***all commands*** and
    ***all batch files*** verbatim. Someone will tell you what's
    wrong. It is highly unlikely that it is copy vs. xcopy.
  4. Archived from groups: microsoft.public.windowsxp.general (More info?)

    Thanks for the quick response. I admit I was surprised when the
    manual test worked. I will be back at the client on Friday and will
    be able to do the tests you suggest. I will advise results. Thanks,
    again.


    On Thu, 1 Sep 2005 13:14:37 +1000, "Pegasus \(MVP\)" <I.can@fly.com>
    wrote:

    >
    >"Bob Felton" <bob123.removethis@fieldtown.net> wrote in message
    >news:g7rch1h9jd6tmf1nd3sv43v7ahvv655vac@4ax.com...
    >> Have two Windows XP Pro SP2 computers on a workgroup LAN: comp1 and
    >> comp2. Simple networking has been turned off on both. I have a
    >> folder on comp2 shared and a drive letter on comp1 mapped to it. User
    >> access rights were set via Security and tested using Windows Explorer.
    >> In the Windows GUI I can copy files from comp1 to the mapped drive
    >> using Windows Explorer without problem. I create a batch file to
    >> xcopy the same file and when run from the GUI (double clicking) or
    >> from a cmd prompt, it fails. Filenames appear but have 0 bytes.
    >> "Access denied" is returned when trying from the cmd prompt .
    >> However, if i manually copy the file from within the cmd prompt by
    >> simply typing the command it works! I note now, however, that the
    >> batch file is using xcopy and the manual copy used copy. I failed to
    >> test manually using xcopy. Can anyone point me to the problem and how
    >> to solve? Is it as simple as using copy vs xcopy? Tnx es 73!
    >> --
    >> Bob Felton
    >
    >There is no difference between running a command from the
    >Command Prompt or running it inside a batch file. Your
    >problem is caused by something else that is not apparent
    >from your post. To find out what it is, run these simple tests:
    >
    >1. From a Command Prompt, type the copy command that
    >works, e.g.
    >
    >copy "c:\Some Folder\Some Subfolder\Some File.doc" x:\Docs
    >
    >2. Now type type command from the Command Prompt:
    >
    >echo copy "c:\Some Folder\Some Subfolder\Some File.doc" x:\Docs >
    >c:\test.bat
    >(this is one long line!).
    >
    >3. Now type this from the Command Prompt:
    >
    >c:\test.bat
    >
    >I bet that it works! Conversely, do the same thing with your
    >original failing batch files: Retype its xcopy.exe command verbatim
    >on the Command Line. It will fail too!
    >
    >If you still have a problem, post ***all commands*** and
    >***all batch files*** verbatim. Someone will tell you what's
    >wrong. It is highly unlikely that it is copy vs. xcopy.
    >

    --
    Bob Felton
  5. Archived from groups: microsoft.public.windowsxp.general (More info?)

    Problem solved! Problem was a command line switch (/o) I was using in
    each xcopy line in the batch file. When that switch was deleted, the
    batch file ran as designed. Thanks, again, for your assistance in
    this matter.


    On Wed, 31 Aug 2005 20:02:48 -0700, Bob Felton
    <bob123.removethis@fieldtown.net> wrote:

    >Have two Windows XP Pro SP2 computers on a workgroup LAN: comp1 and
    >comp2. Simple networking has been turned off on both. I have a
    >folder on comp2 shared and a drive letter on comp1 mapped to it. User
    >access rights were set via Security and tested using Windows Explorer.
    >In the Windows GUI I can copy files from comp1 to the mapped drive
    >using Windows Explorer without problem. I create a batch file to
    >xcopy the same file and when run from the GUI (double clicking) or
    >from a cmd prompt, it fails. Filenames appear but have 0 bytes.
    >"Access denied" is returned when trying from the cmd prompt .
    >However, if i manually copy the file from within the cmd prompt by
    >simply typing the command it works! I note now, however, that the
    >batch file is using xcopy and the manual copy used copy. I failed to
    >test manually using xcopy. Can anyone point me to the problem and how
    >to solve? Is it as simple as using copy vs xcopy? Tnx es 73!

    --
    Bob Felton
Ask a new question

Read More

Windows Explorer Command Prompt Windows XP