10

I need to run xcopy command. But when I type it with all parameters:

xcopy \\<server>.<domain>.com\c$\Users\<user>\Documents\New_ADuser_mustang.ps1 C:\IAM\New_ADuser_mustang.ps1 /C /Y /R

I'm prompted with a question

Does C:\IAM\New_ADuser_mustang.ps1 specify a file name or directory name on the target (F = file, D = directory)?

I need to specify that before I run the command, not after that. The command is run as a part of automated daily task, so there is no one who could answer this question.

1 Answer 1

14

How do I force xcopy to assume the destination is a file not a directory?

Add an asterix * to the destination file name, like so:

C:\IAM\New_ADuser_mustang.ps1*

This works because:

Adding a wildcard (*) to the end of the destination will suppress this prompt and default to copying as a file

Source: Xcopy - Copy files and folders - Windows CMD - SS64.com


Further Reading

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .