Windows 7 Forums


Reply
Thread Tools

BAT file to copy across network

 
 
John Price
Guest
Posts: n/a
Thanked:
 
      06-02-2012
Hi

I'm trying to write a BAT file to copy files from one computer across
to another computer on the network. Sharing and permissions are granted
to allow read/write. Both computers running Win 7. Can copy back and
forth at will using Windows Explorer.

The content I've got so far is

CD\
xcopy c:\forcopy\*.* \\MAIN-DESKTOP\c$\forcopy1 /D /E /Y
pause

but this returns an error "Invalid drive specifiction" when I run the
BAT file containing it

I've tried changing the $ sign to a colon, but same result.

If I change the destination path to another folder on the source drive
it works fine, so it must be something about the path as it's shown
above. Or is this something that isn't possible.

What's wrong?

Many thanks

--

 
Reply With Quote
 
 
 
 
Bob I
Guest
Posts: n/a
Thanked:
 
      06-02-2012
Try using the "share name" of the destination folder instead of the
administrative share "\\MAIN-DESKTOP\c$\forcopy1"

On 6/2/2012 8:46 AM, John Price wrote:
> Hi
>
> I'm trying to write a BAT file to copy files from one computer across
> to another computer on the network. Sharing and permissions are granted
> to allow read/write. Both computers running Win 7. Can copy back and
> forth at will using Windows Explorer.
>
> The content I've got so far is
>
> CD\
> xcopy c:\forcopy\*.* \\MAIN-DESKTOP\c$\forcopy1 /D /E /Y
> pause
>
> but this returns an error "Invalid drive specifiction" when I run the
> BAT file containing it
>
> I've tried changing the $ sign to a colon, but same result.
>
> If I change the destination path to another folder on the source drive
> it works fine, so it must be something about the path as it's shown
> above. Or is this something that isn't possible.
>
> What's wrong?
>
> Many thanks
>

 
Reply With Quote
 
 
 
 
JIP
Guest
Posts: n/a
Thanked:
 
      06-02-2012
Bob I wrote:

> Try using the "share name" of the destination folder instead of the
> administrative share "\\MAIN-DESKTOP\c$\forcopy1"
>
> On 6/2/2012 8:46 AM, John Price wrote:
> > Hi
> >
> > I'm trying to write a BAT file to copy files from one computer
> > across to another computer on the network. Sharing and permissions
> > are granted to allow read/write. Both computers running Win 7. Can
> > copy back and forth at will using Windows Explorer.
> >
> > The content I've got so far is
> >
> > CD\
> > xcopy c:\forcopy\*.* \\MAIN-DESKTOP\c$\forcopy1 /D /E /Y
> > pause
> >
> > but this returns an error "Invalid drive specifiction" when I run
> > the BAT file containing it
> >
> > I've tried changing the $ sign to a colon, but same result.
> >
> > If I change the destination path to another folder on the source
> > drive it works fine, so it must be something about the path as it's
> > shown above. Or is this something that isn't possible.
> >
> > What's wrong?
> >
> > Many thanks
> >


Sorry - could you show an example of what you mean - not sure what the
share name of the folder would look like.

--

 
Reply With Quote
 
Don Phillipson
Guest
Posts: n/a
Thanked:
 
      06-02-2012
"John Price" <> wrote in message
news:-76dnTxC1-...

> I'm trying to write a BAT file to copy files from one computer across
> to another computer on the network. Sharing and permissions are granted
> to allow read/write. Both computers running Win 7. Can copy back and
> forth at will using Windows Explorer.
>
> The content I've got so far is
>
> CD\
> xcopy c:\forcopy\*.* \\MAIN-DESKTOP\c$\forcopy1 /D /E /Y
> pause
>
> but this returns an error "Invalid drive specifiction" when I run the
> BAT file containing it


The p.d. utility at www.xxcopy.com may meet your needs better.
Its many parameters are unusually well documented.

--
Don Phillipson
Carlsbad Springs
(Ottawa, Canada)


 
Reply With Quote
 
Stan Brown
Guest
Posts: n/a
Thanked:
 
      06-02-2012
On Sat, 02 Jun 2012 08:46:32 -0500, John Price wrote:
>
> Hi
>
> I'm trying to write a BAT file to copy files from one computer across
> to another computer on the network. Sharing and permissions are granted
> to allow read/write. Both computers running Win 7. Can copy back and
> forth at will using Windows Explorer.
>
> The content I've got so far is
>
> CD\
> xcopy c:\forcopy\*.* \\MAIN-DESKTOP\c$\forcopy1 /D /E /Y
> pause
>
> but this returns an error "Invalid drive specifiction" when I run the
> BAT file containing it
>
> I've tried changing the $ sign to a colon, but same result.
>
> If I change the destination path to another folder on the source drive
> it works fine, so it must be something about the path as it's shown
> above. Or is this something that isn't possible.
>
> What's wrong?
>
> Many thanks


You need to precede that with a NET USE command, such as

net use p: \\main-desktop\C$
xcopy c:\forcopy\*.* p:\forcopy1 /D /E /Y
:: Optional, if you want to disconnect the mapped network drive.
net use p: /d

I assume no login is required for the network folder. If it is,
change the NET USE command to
net use p: \\main-desktop\C$ * /user:MyUsername
(substituting your actual user name, of course).


--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com
Shikata ga nai...
 
Reply With Quote
 
charlie
Guest
Posts: n/a
Thanked:
 
      06-02-2012
On 6/2/2012 9:46 AM, John Price wrote:
> Hi
>
> I'm trying to write a BAT file to copy files from one computer across
> to another computer on the network. Sharing and permissions are granted
> to allow read/write. Both computers running Win 7. Can copy back and
> forth at will using Windows Explorer.
>
> The content I've got so far is
>
> CD\
> xcopy c:\forcopy\*.* \\MAIN-DESKTOP\c$\forcopy1 /D /E /Y
> pause
>
> but this returns an error "Invalid drive specifiction" when I run the
> BAT file containing it
>
> I've tried changing the $ sign to a colon, but same result.
>
> If I change the destination path to another folder on the source drive
> it works fine, so it must be something about the path as it's shown
> above. Or is this something that isn't possible.
>
> What's wrong?
>
> Many thanks
>



I can think of a couple of things to try.
First complex expressions such as your networked drive might need quotes
to allow the entire expression to be used.
Next, since this is a batch file, setting the expression into a variable
might get the job done.

Another way might be to assign the network drive/sub-directory a drive
letter.

It's been more than a few years since I had to do this sort of thing
using earlier windows versions.




 
Reply With Quote
 
Nil
Guest
Posts: n/a
Thanked:
 
      06-02-2012
On 02 Jun 2012, "John Price" <> wrote in
alt.windows7.general:

> I'm trying to write a BAT file to copy files from one computer
> across to another computer on the network. Sharing and permissions
> are granted to allow read/write. Both computers running Win 7. Can
> copy back and forth at will using Windows Explorer.
>
> The content I've got so far is
>
> CD\
> xcopy c:\forcopy\*.* \\MAIN-DESKTOP\c$\forcopy1 /D /E /Y
> pause
>
> but this returns an error "Invalid drive specifiction" when I run
> the BAT file containing it
>
> I've tried changing the $ sign to a colon, but same result.
>
> If I change the destination path to another folder on the source
> drive it works fine, so it must be something about the path as
> it's shown above. Or is this something that isn't possible.
>
> What's wrong?


I tried it and got the same thing. I also have the whole drive shared
with a regular share name, \\C-Drive , and if I use that instead of the
administrative share name C$, it works as expected. Your version DOES
work when xcopying from a Win7 computer to an XP one.

Odd...
 
Reply With Quote
 
Roger Mills
Guest
Posts: n/a
Thanked:
 
      06-02-2012
On 02/06/2012 14:46, John Price wrote:
> Hi
>
> I'm trying to write a BAT file to copy files from one computer across
> to another computer on the network. Sharing and permissions are granted
> to allow read/write. Both computers running Win 7. Can copy back and
> forth at will using Windows Explorer.
>
> The content I've got so far is
>
> CD\
> xcopy c:\forcopy\*.* \\MAIN-DESKTOP\c$\forcopy1 /D /E /Y
> pause
>
> but this returns an error "Invalid drive specifiction" when I run the
> BAT file containing it
>
> I've tried changing the $ sign to a colon, but same result.
>
> If I change the destination path to another folder on the source drive
> it works fine, so it must be something about the path as it's shown
> above. Or is this something that isn't possible.
>
> What's wrong?
>
> Many thanks
>


Since forcopy1 is a folder rather than a file, don't you need a
backslash after it?

As others have said, it's a good idea to map a network drive to this
share. If you do it in Windows Explorer, and tell it to reconnect on
logon, you'll only have to do it once. So if, for example, you map Z: to
\\MAIN-DESKTOP\c$, you can set up your batch file to say:

xcopy c:\forcopy\*.* z:\forcopy1\ /D /E /Y

--
Cheers,
Roger
____________
Please reply to Newsgroup. Whilst email address is valid, it is seldom
checked.
 
Reply With Quote
 
Fokke Nauta
Guest
Posts: n/a
Thanked:
 
      06-03-2012

"John Price" <> wrote in message
news:-76dnTxC1-...
> Hi
>
> I'm trying to write a BAT file to copy files from one computer across
> to another computer on the network. Sharing and permissions are granted
> to allow read/write. Both computers running Win 7. Can copy back and
> forth at will using Windows Explorer.
>
> The content I've got so far is
>
> CD\
> xcopy c:\forcopy\*.* \\MAIN-DESKTOP\c$\forcopy1 /D /E /Y
> pause
>
> but this returns an error "Invalid drive specifiction" when I run the
> BAT file containing it
>
> I've tried changing the $ sign to a colon, but same result.
>
> If I change the destination path to another folder on the source drive
> it works fine, so it must be something about the path as it's shown
> above. Or is this something that isn't possible.
>
> What's wrong?
>
> Many thanks
>


The xcopy command wants to see a drive letter instead of a share name. You
need to map a network drive. See the comments of Stan Brown.

Succes,

Fokke


 
Reply With Quote
 
JIP
Guest
Posts: n/a
Thanked:
 
      06-03-2012
Stan Brown wrote:

> On Sat, 02 Jun 2012 08:46:32 -0500, John Price wrote:
> >
> > Hi
> >
> > I'm trying to write a BAT file to copy files from one computer
> > across to another computer on the network. Sharing and permissions
> > are granted to allow read/write. Both computers running Win 7. Can
> > copy back and forth at will using Windows Explorer.
> >
> > The content I've got so far is
> >
> > CD\
> > xcopy c:\forcopy\*.* \\MAIN-DESKTOP\c$\forcopy1 /D /E /Y
> > pause
> >
> > but this returns an error "Invalid drive specifiction" when I run
> > the BAT file containing it
> >
> > I've tried changing the $ sign to a colon, but same result.
> >
> > If I change the destination path to another folder on the source
> > drive it works fine, so it must be something about the path as it's
> > shown above. Or is this something that isn't possible.
> >
> > What's wrong?
> >
> > Many thanks

>
> You need to precede that with a NET USE command, such as
>
> net use p: \\main-desktop\C$
> xcopy c:\forcopy\*.* p:\forcopy1 /D /E /Y
> :: Optional, if you want to disconnect the mapped network drive.
> net use p: /d
>
> I assume no login is required for the network folder. If it is,
> change the NET USE command to
> net use p: \\main-desktop\C$ * /user:MyUsername
> (substituting your actual user name, of course).


Thanks Stan - when I use your first e.g. I'm asked for a username -
which it lets me input, and then asks for a network password. I'm not
aware of ever setting one, but in any event when I try to type in at
that point, it doesn't accept input from the keyboard - except for the
ENTER key - and I then get invalid password messages.

When I try the second on, it goes stiiaght to the request for a network
password, and the same thing happens - canty input from the keyboard,
and yet hitting the ENTER key moves on to the invalid password message.

Any more ideas?

JIP

--

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Having copies renamed as per old style "Copy of ..." rather than file name then copy at end? StargateFan alt.windows7.general 37 11-17-2012 11:43 PM
create a .bat file to disable wireless when you connect to wired TOSH1 General Discussion 4 10-06-2012 07:12 AM
printing across a wireless network badgolferman alt.windows7.general 5 03-05-2012 05:52 PM
Run an instal.bat file as administrator bd alt.windows7.general 5 08-08-2011 02:35 AM
vcvarsall.bat no 64bit support vcvars64.bat missing svrich General Discussion 1 12-07-2010 08:59 PM


All times are GMT +1. The time now is 11:15 PM.
W7Forums is an independent website and is not affiliated with Microsoft Corporation.