Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a script in an application. The application should call cmd.exe and cmd.exe should run a statement

pushd \\file\share && move filename.txt \\file\share\newfilename.txt && popd 

But this generates an error in an application

Program terminated with exit code <1>

When I run the same statement just replace move with copy, everything works fine

pushd \\file\share && copy filename.txt \\file\share\newfilename.txt && popd

Also ren and del are producing the same result as move. Any ideas why this is happening? All these works from the command prompt just fine.

share|improve this question
up vote 0 down vote accepted

This will most likely be a permissions issue. To move the file you need to have permission to delete (modify) both the source and the destination. This also explains why del and ren fail while copy works (only write permission required).

share|improve this answer
Thanks. Maybe it is a permission problem, but I cannot understand why move command works from the command line using the same crendentials... – jrara Jul 22 '11 at 11:52
@jrara: You should add that information to your question. – Iain Jul 22 '11 at 12:01
Ok, thanks, I edited the question – jrara Jul 22 '11 at 18:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.