I'm trying to create a script to copy a file to a backup drive.. This is what I'm using:
@echo off
xcopy source destination /c /d /h /i /k /q /r /s /x /y
It doesn't seem to be working. I'm really new to this. Can someone help me??
Help creating xcopy batch file??
Moderator: DosItHelp
Re: Help creating xcopy batch file??
If source is a directory, and
destination is a directory too, or not existing, and
your batch is in the right directory,
then this code should work well.
Maybe you rem out the @echo off line, and see what error message will be displayed.
penpen
destination is a directory too, or not existing, and
your batch is in the right directory,
then this code should work well.
Maybe you rem out the @echo off line, and see what error message will be displayed.
penpen
Re: Help creating xcopy batch file??
I have a feeling that it is something stupid that I am overlooking. All I did was type this up in a notepad document, save it with a .bat extension, and then try to open it through windows explorer. When I do, I see a command prompt pop up briefly and then disappear. Nothing seems to copy or change. I know the actual xcopy command is good because I've tried it in the command prompt and it works fine.
Re: Help creating xcopy batch file??
Open a cmd prompt and 'cd' to your bat folder and type in the bat name. You will see the error message then.
Re: Help creating xcopy batch file??
I just ran it from command line like you asked. This is the error:
Access denied
0 files copied
Because it's not running as admin I'm assuming?? how do I fix it? This is windows 8 by the way. I'm not sure if that's relevant.
Access denied
0 files copied
Because it's not running as admin I'm assuming?? how do I fix it? This is windows 8 by the way. I'm not sure if that's relevant.
Re: Help creating xcopy batch file??
I just discovered the fix. By checking, "Run with highest privileges", in task scheduler I was able to make it run as admin. This worked beautifully. Thanks guys.