views:

27

answers:

1

As a part of an automated script, I am trying to do achieve something like this in windows command prompt:

xcopy /I /Y resources\xyz\pqrs.txt %TEMP%\resources\xyz\pqrs.txt.bak

In %TEMP%, there is no resources directory.

This is the interactive output, that I get:

Does C:\Users\username\AppData\Local\Temp\resources\xyz\pqrs.txt.bak specify a file name
or directory name on the target
(F = file, D = directory)?

The whole thing is that I want to create a directory and copy file without interaction.

If I use a mkdir, I will have to extract the directory path out before using mkdir. I was just wondering if its possible to use xcopy to achieve mkdir+copy at the same time.

xcopy reference for all.

Thanks for the help.

A: 

Try this:

echo d| xcopy /f C:\abc\file1 C:\abc\newfolder\file2

Ricardo
Just to clarify, echo d| answers to create a directory while echo f| to create a file.
Ricardo
... and it only will work on an English version of Windows ...
Joey
Really? Do you know why? Is there a solution for other languages? Is it because of the options first letter in the xcopy command? If so, all you have to do is replace in 'echo x|' the x for the appropriate first letter.
Ricardo