سؤال

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.

هل كانت مفيدة؟

المحلول

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...
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top