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 (
end)
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
http://www.robvanderwoude.com/ntfor... Oh sorry you said BASH not BATCH. There is no BASH in Windows 7 post this in the Linux Forum.
Also post your problem in this forum: http://www.computing.net/forum/prog...
Home Page http://ewen.uuuq.com/
Something like this: @echo off
set p_computer=computer
set p_driveletter=Lnet use %p_driveletter% /DELETE
if exist %p_driveletter%:\ goto error1net use %p_driveletter% \\%p_computer%\c$
if NOT exist %p_driveletter%:\ goto error2copy whatever %p_driveletter%:\
goto :EOF:error1
echo.
echo Driveletter %p_driveletter% could not be removed
goto :EOF:error2
echo.
echo Share \\%p_computer%\c$ could not be setup
goto :EOF
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. :)
Easier method: net use \\computer\c$ || goto :error pushd \\computer\c$ goto :eof :error @echo Error mounting remote drive
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 ?
In the en-US version, the only reference I found is in the help topic titled Command shell overview.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |