need to copy folder with sub folder without answering prompt
You have two main options here:
The first option is to add the /i
parameter. The related text in the documentation is as follows:
If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes Destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopy prompts you to specify whether Destination is a file or a directory.
Another option is to specify that the destination is a directory by ending it with a backslash, which would make the code look like this:
xcopy sushantg\A\* sushantg\B\ /s /e /h /T
(Note the trailing backslash after the B
)
I can't find any relevant documentation for this option at the moment, but I tested it locally and it fixed the issue.