"move" command WITH prompt if target exists?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
tobwz
Posts: 30
Joined: 25 Feb 2022 03:21

"move" command WITH prompt if target exists?

#1 Post by tobwz » 25 Sep 2022 11:41

Ok, I could move one or multiple files or folders on the command line in a batch script by a command like

move /y \"%1\" \"D:\mydata\\"

Unfortunately all files/folders are moved regardless if the target files/folders exist or not.

How can I extend the command above so that a prompt appears if the files/folders exists and ask me if I want to overwrite them?

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: "move" command WITH prompt if target exists?

#2 Post by aGerman » 25 Sep 2022 13:00

Run MOVE /? and read about the difference between options /Y and /-Y.

Steffen

tobwz
Posts: 30
Joined: 25 Feb 2022 03:21

Re: "move" command WITH prompt if target exists?

#3 Post by tobwz » 27 Sep 2022 08:45

works.
Thank you

Post Reply