Batch moving files fails, but works in cmd

March 15, 2012 at 02:38:25
Specs: Windows Server 2008 R2 Enterprise

Note that I have very limited knowladge about the entire subject and only know stuff I found googling.

I am having trouble with moving files with a batch file. I am using:

move /-y "E:\folder\file.txt" "E:\folder\folder\"

If I run the command in cmd it works fine. However if I start the batch file it says "The device is not ready".

After some searching most answers point to this being an issue with detachable storage devices which is not the case at the moment.

Any thoughts what could be the reason? I initially thought that it could be permission related however I can run other batch files without any problems.

Your help would be much appreciated.

See More: Batch moving files fails, but works in cmd

Report •

March 15, 2012 at 06:49:26
move /-y "E:\folder\file.txt" "E:\folder\folder\file.txt"

seemed to work for me,


Report •

March 15, 2012 at 07:55:12
Managed to resolve this on my own. For some reason by removing the brackets from the destination made it work. While not too relevant, but would be nice to know why this had an impact.

Report •

March 16, 2012 at 02:20:22
"For some reason by removing the brackets from the destination made it work."

Do you mean you removed the two double-quotes? Are you sure that's what did it? It is unclear what worked/didn't work. What kind of device is E:? What are the actual folder names? For anyone to recreate what you are experiencing it would be very helpful (or maybe essential) to know the exact commands that work or don't work.

What you seem to be describing sounds very strange to me. Please share your problem and solution to expand the knowledge base at this forum. Thanks.

Report •

Related Solutions

March 16, 2012 at 09:21:07
My apology for not being very specific. It mostly comes from the lack of knowladge. Here is a sample of a command that I ran in the batch file which failed:

move /-y "E:\Data\file.txt" "E:\Data\Test\"

So what I wanted to achieve is to move the file called "file.txt" to the Test folder. If I ran this in the command line it worked fine. However when I added the command to a batch file and ran the batch file it failed stating that The device is not ready. Afterwards I modified the batch file like this:

move /-y "E:\Data\file.txt" E:\Data\Test\

After this modification the batch file ran without any problems. While I am happy that my issue is resolved I am totally clueless why this worked.

Report •

March 20, 2012 at 01:31:13
That is surprising! Hard to believe nothing else changed. Everything has to be the same: "file.txt" has to either exist or not exist at the destination (and at the source) for all trials. The real test would be to run the batch sucessfully, then put the quotes back in and see if it fails on the very next try in the same command window. Take out the quotes, and if it works again, then you're sure. Well, almost. It can be really hard to be certain that you have elimanated every variable.

What kind of device is "E:"?

Report •

March 20, 2012 at 05:21:54
I blame the anti-virus program, but that's more out of policy than any epiphany.

This assumes the hardware is stable and functioning correctly, obviously.

How To Ask Questions The Smart Way

Report •

Ask Question