Click here for important information about

bash file copy over network

Microsoft Windows 7 ultimate 64-bit
March 8, 2010 at 09:07:18
Specs: Windows XP/7
hello im attempting to make a batch file to copy files from one computer to another over the network.

so i was thinking somthing like

ping \\computer\c$
if computer = found
( do copy)
else (

for the copy im going to use somthing like
xcopy "c:\source" to "\\destcomp\user\destination"

Would that work for mounting the computer as a share or would their be a better way to go about this??
thank you in advance

See More: bash file copy over network

March 8, 2010 at 10:00:40

Oh sorry you said BASH not BATCH. There is no BASH in Windows 7 post this in the Linux Forum.

Report •

March 8, 2010 at 14:13:24
Also post your problem in this forum:

Home Page

Report •

March 9, 2010 at 02:42:06
Something like this:

@echo off

set p_computer=computer
set p_driveletter=L

net use %p_driveletter% /DELETE
if exist %p_driveletter%:\ goto error1

net use %p_driveletter% \\%p_computer%\c$
if NOT exist %p_driveletter%:\ goto error2

copy whatever %p_driveletter%:\
goto :EOF

echo Driveletter %p_driveletter% could not be removed
goto :EOF

echo Share \\%p_computer%\c$ could not be setup
goto :EOF

Report •

Related Solutions

March 9, 2010 at 05:51:24
thanks alot everybody i do have something like what TVC said i used the net use command to mount but dont have the error checking, thanks for the help i appreciate it. :)

Report •

March 9, 2010 at 05:56:39
Easier method:
net use \\computer\c$ || goto :error
pushd \\computer\c$
goto :eof

@echo Error mounting remote drive

Report •

March 9, 2010 at 09:02:45
net use \\computer\c$ || goto :error

I've seen exactly this kind of coding being used on *nix as well, can you post me where in Windows help/manual you find an example of such usage of code ?

Report •

March 9, 2010 at 10:02:11
In the en-US version, the only reference I found is in the help topic titled Command shell overview.

Report •

Ask Question