Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.