Batch COPY not working on Windows 8
Moderator: DosItHelp
Batch COPY not working on Windows 8
Hi everyone,
I always been using batch scrinting to: COPY, MOVE, DELETE, etc.
Somehow all my attempts with my scripts seem to fail on Windows 8.
Here is what am doing, I want to copy files right from the desktop to:
"C:\WINDOWS\MyFolder" but I get an "ACCESS DENIED" I am aware that
UAC is disable, and also I right-click on my script and run as an administrator,
But still nothing, no matter how I try batch xcopy or copy does not seem to work!
Is there a way arround this?
Thanks in advance
I always been using batch scrinting to: COPY, MOVE, DELETE, etc.
Somehow all my attempts with my scripts seem to fail on Windows 8.
Here is what am doing, I want to copy files right from the desktop to:
"C:\WINDOWS\MyFolder" but I get an "ACCESS DENIED" I am aware that
UAC is disable, and also I right-click on my script and run as an administrator,
But still nothing, no matter how I try batch xcopy or copy does not seem to work!
Is there a way arround this?
Thanks in advance
Re: Batch COPY not working on Windows 8
Folder permissions is what is stopping you. It's a System folder.
Re: Batch COPY not working on Windows 8
I know that...
This is my script:
This is my script:
Code: Select all
Set MyFolder=%~dp0
Set DestDir=C:\WINDOWS\MyFolder
Mkdir "%DestDir%" 2>NUL
COPY "C:\users\%username%\desktop\File.txt" "C:\WINDOWS\MyFolder\File.txt"
Re: Batch COPY not working on Windows 8
Coder wrote:This is my script:Code: Select all
Set MyFolder=%~dp0
Set DestDir=C:\WINDOWS\MyFolder
What is the top command for?
Re: Batch COPY not working on Windows 8
Is a variable reference
-
- Expert
- Posts: 1163
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Batch COPY not working on Windows 8
If you're using MyFolder as a variable, it needs to be %MyVariable%
Also, Set MyFolder=%~dp0 will return the full folder name of the folder the script was called from, including the drive letter (that's what the d is for), so calling the script in C:\Users\Coder\Documents\Scripts would have the next command be the equivalent of
which isn't at all what you want.
Also, Set MyFolder=%~dp0 will return the full folder name of the folder the script was called from, including the drive letter (that's what the d is for), so calling the script in C:\Users\Coder\Documents\Scripts would have the next command be the equivalent of
Code: Select all
set DestDir=C:\Windows\C:\Users\Coder\Documents\Scripts\
which isn't at all what you want.
Re: Batch COPY not working on Windows 8
Shadow, this is what I want to accomplish...
Run my batch script and a folder is create under C:\WINDOWS\MyFolder
Right after that my File.txt will be copied to that directorie
Thats it
But I'm stuck cuz I need a batch script with elevate privileges in order to do this task.
Run my batch script and a folder is create under C:\WINDOWS\MyFolder
Right after that my File.txt will be copied to that directorie
Thats it
But I'm stuck cuz I need a batch script with elevate privileges in order to do this task.
-
- Expert
- Posts: 1163
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Batch COPY not working on Windows 8
I'm not sure what your problem is. I right-clicked and ran the batch file as an administrator like you did and mine works fine.
Re: Batch COPY not working on Windows 8
The weird thing on your example is that I don't see the name
of the batch script running. I mean, your example look like when
you run cmd and then type a command and hit enter. and by the way,
here is one thing that I noticed, if you install Windows 8 on Windows 7,
you don't get to see this error that much, it only happens when you try
this on a non-upgrade 8 the other thing I see in your script is that it look
so simple to execute a task like that without getting a single access denied issue.
is that were the case I would't be here looking for this solution, but I had asked this
same question in some many forums and no one seemed to know anything about it.
I just tried this on it and I get an access denied. in conclution what I tried is to change
the extention from .bat to .cmd but still not working. and yeah, what I need is to be able
to copy from one place to this protected sub-directories, sus as Windows, System32, etc.
Thanks Shadow
of the batch script running. I mean, your example look like when
you run cmd and then type a command and hit enter. and by the way,
here is one thing that I noticed, if you install Windows 8 on Windows 7,
you don't get to see this error that much, it only happens when you try
this on a non-upgrade 8 the other thing I see in your script is that it look
so simple to execute a task like that without getting a single access denied issue.
is that were the case I would't be here looking for this solution, but I had asked this
same question in some many forums and no one seemed to know anything about it.
I just tried this on it and I get an access denied. in conclution what I tried is to change
the extention from .bat to .cmd but still not working. and yeah, what I need is to be able
to copy from one place to this protected sub-directories, sus as Windows, System32, etc.
Thanks Shadow
-
- Expert
- Posts: 1163
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Batch COPY not working on Windows 8
The name of the script isn't supposed to pop up in the title bar of the command prompt (it didn't do this in Windows 7 either), and I definitely right-click-run-as-Administrator'ed the file.
This is a Windows 8.1 Pro virtual machine, completely fresh install.
What happens when you open the command prompt as an Administrator and try to make the folder manually?
This is a Windows 8.1 Pro virtual machine, completely fresh install.
What happens when you open the command prompt as an Administrator and try to make the folder manually?
Re: Batch COPY not working on Windows 8
Shadow, I knew it, yeah, look, if you try this on a laptop or desktop with
Windows 8 that comes with it, for some reasons I get this access denied issue,
But if I take a laptop and I install Windows 8 on it and try, I don't get this issue.
I even post this question on expert-exchange and they tried and then they agree
with me on that subject, is weird but is true, don't know why, and as for your question,
when I run my batch file I always add a PAUSE add an output .log error to check what
went wrong, and yeah, I keep getting ACCES DENIED. last night I finally gived up and
started to write a tool an Visual Basic that can allow me to do this, and so far so good.
Windows 8 that comes with it, for some reasons I get this access denied issue,
But if I take a laptop and I install Windows 8 on it and try, I don't get this issue.
I even post this question on expert-exchange and they tried and then they agree
with me on that subject, is weird but is true, don't know why, and as for your question,
when I run my batch file I always add a PAUSE add an output .log error to check what
went wrong, and yeah, I keep getting ACCES DENIED. last night I finally gived up and
started to write a tool an Visual Basic that can allow me to do this, and so far so good.
-
- Expert
- Posts: 1163
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Batch COPY not working on Windows 8
What version of Windows 8 are you using? Starter? Home? Professional? 8? 8.1? I want to try to match your environment as closely as possible.
That didn't answer my question at all.
Forget the batch file completely for a second. Open the command prompt as an Administrator. Type in mkdir C:\Windows\MyFolder. Do you still get an ACCESS DENIED error?
Coder wrote: and as for your question, when I run my batch file I always add a PAUSE add an output .log error to check what went wrong, and yeah, I keep getting ACCESS DENIED.
That didn't answer my question at all.
Forget the batch file completely for a second. Open the command prompt as an Administrator. Type in mkdir C:\Windows\MyFolder. Do you still get an ACCESS DENIED error?
Re: Batch COPY not working on Windows 8
My bad, here is an screenshot, and yes, I was able to make the dir with no issues,
but I have no problem doing this with a batch file as long as I run the batch as an admin,
But not the copy proccess, that even if I run the batch normal or as an admin, it will not do the trick.
but I have no problem doing this with a batch file as long as I run the batch as an admin,
But not the copy proccess, that even if I run the batch normal or as an admin, it will not do the trick.
Re: Batch COPY not working on Windows 8
This is the error I get if I try to copy files:
Re: Batch COPY not working on Windows 8
Is there no Alt+Prtscreen or Snipping Tool in Windows 8 for Screenshots?