• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5824
  • Last Modified:

Problem using DOS COPY command across network

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?

1 Solution
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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...
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>:
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.
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.
One other thing, if the path has spaces then use inverted comma's eg:
copy "\\pcname\c$\program files\test\*.*" "c:\folder"

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now