XCOPY Script to Copy File to Network Connection

  • Thread starter Thread starter Karl Burrows
  • Start date Start date
K

Karl Burrows

Hi!

I am trying to write a script (newbie!!) to copy a text file from a remote
computer to our home office server through a VPN connection. Instead of
mapping the drive on the remote computer (to avoid accidental
disconnection), I setup a Network Place for the VPN folder.

All remote computers run Win2000 and server is Win2000 Server.

Here is what I have so far, but can't get the script to execute. Any
suggestions would be greatly appreciated!

@ECHO OFF
ECHO * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
ECHO * This will copy the MWS Payroll Data to the Home Office *
ECHO * Make sure you have saved your current Payroll data *
ECHO * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
ECHO.
ECHO Press CTRL-C to abort
ECHO or
PAUSE


XCOPY C:\Documents and Settings\Remote User\Desktop\Test.txt \\Server\Copy
Folder /f /v /z

if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 0 goto exit

:lowmemory
echo Insufficient memory to copy files or
echo invalid drive or command-line syntax.
goto exit

:abort
echo You pressed CTRL+C to end the copy operation.
goto exit

:exit
 
XCOPY "C:\Documents and Settings\Remote User\Desktop\Test.txt"
"\\Server\CopyFolder" /f /v /z


Hi!

I am trying to write a script (newbie!!) to copy a text file from a remote
computer to our home office server through a VPN connection. Instead of
mapping the drive on the remote computer (to avoid accidental
disconnection), I setup a Network Place for the VPN folder.

All remote computers run Win2000 and server is Win2000 Server.

Here is what I have so far, but can't get the script to execute. Any
suggestions would be greatly appreciated!

@ECHO OFF
ECHO * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
ECHO * This will copy the MWS Payroll Data to the Home Office *
ECHO * Make sure you have saved your current Payroll data *
ECHO * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
ECHO.
ECHO Press CTRL-C to abort
ECHO or
PAUSE


XCOPY C:\Documents and Settings\Remote User\Desktop\Test.txt \\Server\Copy
Folder /f /v /z

if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 0 goto exit

:lowmemory
echo Insufficient memory to copy files or
echo invalid drive or command-line syntax.
goto exit

:abort
echo You pressed CTRL+C to end the copy operation.
goto exit

:exit


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Just add the quotes? It still isn't doing anything. The DOS screen opens
and I get the prompt to start the operation. I hit a key and the screen
then just disappears. No copy.

Am I missing something else?

Thanks!


XCOPY "C:\Documents and Settings\Remote User\Desktop\Test.txt"
"\\Server\CopyFolder" /f /v /z


Hi!

I am trying to write a script (newbie!!) to copy a text file from a remote
computer to our home office server through a VPN connection. Instead of
mapping the drive on the remote computer (to avoid accidental
disconnection), I setup a Network Place for the VPN folder.

All remote computers run Win2000 and server is Win2000 Server.

Here is what I have so far, but can't get the script to execute. Any
suggestions would be greatly appreciated!

@ECHO OFF
ECHO * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
ECHO * This will copy the MWS Payroll Data to the Home Office *
ECHO * Make sure you have saved your current Payroll data *
ECHO * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
ECHO.
ECHO Press CTRL-C to abort
ECHO or
PAUSE


XCOPY C:\Documents and Settings\Remote User\Desktop\Test.txt \\Server\Copy
Folder /f /v /z

if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 0 goto exit

:lowmemory
echo Insufficient memory to copy files or
echo invalid drive or command-line syntax.
goto exit

:abort
echo You pressed CTRL+C to end the copy operation.
goto exit

:exit


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Hi!

I am trying to write a script (newbie!!) to copy a text file from a remote
computer to our home office server through a VPN connection. Instead of
mapping the drive on the remote computer (to avoid accidental
disconnection), I setup a Network Place for the VPN folder.
I always believed xcopy required drive letters and not unc. Quotes
around long file names with any spaces.

Don't understand your comment about accidental disconnection. If
you've disconnected nothing is going to work. Typically I would do a
net use r: "\\unc path" /y in the batch file.
 
verify you can access the share on the remote computer:

dir \\server\copy folder

If this succeeds then verify you can create a file in this location:

xcopy somefile.txt \\server\copy folder
 
Got it! I already had the network connection, but the script wasn't
running. I added the quotes around the paths and the /y switch and it works
perfectly.

Note: I didn't use a mapped drive so that on a reboot, I didn't want them
to get a message that the network location was not available and possibly
disconnect the mapped drive.

Thanks all!!

verify you can access the share on the remote computer:

dir \\server\copy folder

If this succeeds then verify you can create a file in this location:

xcopy somefile.txt \\server\copy folder
 
Back
Top