Problem using DOS COPY command across network

Posted on 2007-07-23
Last Modified: 2013-11-25
I am trying to view files on
another machine using the DOS copy command  (eventually I will want
to use the DOS copy commands).  These machines are on a Local Area
Net.  The files reside on the machine known as GATEWAYLAPTOP and when
I run the NET VIEW command on machine "A" it identifies  machine "B"
as \\GATEWAYLAPTOP.  So my command is:


However I get an error that the file name or directory is
invalid.  Does anyone know how to do this?

Question by:cashonly
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    C: is invalid. usually, the root of the disks is mapped as c$ for example, hence:


    is the correct UNC path.
    however, I am not sure if DIR works with UNC...

    Expert Comment

    You can't do that, you must go to my computer, click Tools on toolbar > Map Network Drive
    Select a drive letter then the path, click net > finish
    goto to command, type dir <drive_letter>:
    LVL 3

    Expert Comment

    I have a suspision that the XP cmd engine dosen't like UNC paths.
    This means that you may have to map the path as a network drive.

    On machine B (GATEWAYLAPTOP) run the command:
    net share sea=c:\

    On machine A run the command:

    now, you can list the contents of c:\ of machine B on machine A using the following commands:

    And Z:\ will appear in machine As file manager.
    Note that this method will make the connection disapear after machine A is shut down (it gets around that annoying message saying that windows can't connect all of your network drives if machine B isn't there). You may want to write some batch files or put it in a startup script if you want it to connect each time, or you could use the /PERSISTENT:YES option for net use.
    LVL 13

    Accepted Solution

    Open a DOS window and type:
    net use \\computername\c$ /user:username_on_remote_pc and hit enter, you will be prompted for the password of the user account that you used above for the remote PC, enter it.
    After that dir \\computername\c$ will work and so will copy. Rather use robocopy, you can download it from Microsoft, it is a lot more robust for network copies.
    LVL 13

    Expert Comment

    One other thing, if the path has spaces then use inverted comma's eg:
    copy "\\pcname\c$\program files\test\*.*" "c:\folder"

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (…
    When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
    This video discusses moving either the default database or any database to a new volume.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now