Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copying from network share using BAT

What's the best way to copy a file from a network share to the local file system using a Windows batch file? Normally, I would use "net use *" but using this approach how can I get the drive letter?

like image 433
Mike Avatar asked Sep 05 '08 19:09

Mike


People also ask

How do I share files on my local network?

To share files on your local network using the express settings, do the following: Open File Explorer. Navigate to the folder you want to share. Right-click the item, and select Properties. Folder Properties option. On the “Properties” window, click the Sharing tab. Click the Share button. Folder Sharing tab.

How do I copy files over the network using Robocopy?

Once file sharing is configured on the source device, you can copy the files using Robocopy from the destination device. Open Start. Search for Command Prompt, right-click the top result, and select the Run as administrator option. Type the following command to copy the files over the network and press Enter:

How to copy files over the network in Windows 10?

Search for Command Prompt, right-click the top result, and select the Run as administrator option. Type the following command to copy the files over the network and press Enter: robocopy \source-device-ip[&path&]tosharefolder C:destination-device[&path&]tostore[&files&] /E /Z /ZB /R:5 /W:5 /TBD /NP /V /MT:16

How do I copy files between two computers?

To copy files between two computers, you must enable file sharing in the source device to allow Robocopy access to copy the files from the destination device. Use these steps to share files on your local network using the express settings: Open File Explorer on Windows 10.


1 Answers

Can you just use the full UNC path to the file?

copy \\myserver\myshare\myfolder\myfile.txt c:\myfiles
like image 154
Mark Biek Avatar answered Oct 07 '22 22:10

Mark Biek