0

I'm wanting to create a batch file that will back up my computer. This is what I have right now:

@echo off
:: variables
net use U:\\...more stuff...
set drive=U:\
set backupcmd=xcopy /s /c /d /e /i /r /y

echo ### Backing up My Documents...
%backupcmd% "%USERPROFILE%\My Documents" "%drive%\My Backup\My Documents"

echo Backup Complete!
@pause

It's simple enough. It works fine for a drive that is physically attached to my computer. However, I have a networked drive that I'd like to use for this task. I've tried a few things I found on forums, but to no avail. In the above code, I started attempting to use "net use." When I run it, I get "invalid drive specification" or "network path not found."

How can I get this to work?

Any help is appreciated.

Mlagma
  • 1,240
  • 2
  • 21
  • 49
  • If your question is about `net use`, why did you not include the `net use` statement? (`net use U:\\...more stuff...` is pretty much useless, since `...more stuff...` could very well be the problem. There's also a basic problem - "U:\\" isn't a valid drive specification in Windows, as you don't need to escape backslashes and a double-backslash is invalid.) Also, why are you resorting to antiquated batch/xcopy methods for backup, when there are hundreds of more reliable and flexible ways to do this? – Ken White Sep 22 '12 at 01:52

1 Answers1

1

You have:

net use U:\\...more stuff...

but there needs to be a space between the drive specification and the network share:

net use U: \\...more stuff...
Gabe
  • 84,912
  • 12
  • 139
  • 238