99

I want to write a list of windows commands(it's a long list) where it does all these magical things for me, but whenever I use copy, it stops to ask fro overwrite prompt. When I type yes, it overwrites the old file then just stops there.

How do I make it such that whenever the windows sees the copy command, it just overwrites the old file without that prompt?

2 Answers 2

196

You're looking for the /Y switch.

Sign up to request clarification or add additional context in comments.

4 Comments

I tried /h, /help, --help, -h. Didn't think of the question mark, I'll use that next time. Still was happy with this question/answer :)
It's strange that it doesn't work in all cases. I have command C:\WC_Data_Transfer\Portugal>move /Y W:\Portugal\ENCAISSEMENTP.txt W:\Portugal\yesterday\ENCAISSEMENTP.txt Overwrite W:\Portugal\yesterday\ENCAISSEMENTP.txt? (Yes/No/All): on Windows Server 2003 standard edition. "W" is a network drive and mentioned file has permissions for that user and "read only" flag is not set. Doing it manually via Windows explorer it works smoothly. Any ideas how to avoid this?
Some other process was locking that file time to time. So that's because if prompted to overwrite.
Please write the entire command syntax.
2

MOVE /-Y Source Destination

Note:/-y will make the announcement of yes/no for overwrite

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.