Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to run the following command in Windows CLI:

XCOPY Z:\.vimrc %USERPROFILE%\_vimrc /H

The /H part needs to be there because Z:\.vimrc is a hidden file.

When I run the command above, I get the following message:

Does C:\Users\Matt\_vimrc specify a file name
or directory name on target
(F = file, D = directory)?

This command will eventually be part of a BAT file and I don't want that prompt. The answer to it is always "F".

If .vimrc and _vimrc were named the same, I could just run one of these commands and be done with it:


But they are not, so I can't. How do I suppress that message?

I know I could copy it with the same file name and then move it, but c'mon, does this really have to be two commands? I'm just copying a file.

Note: When there is already a %USERPROFILE%\_vimrc file, the message does not appear.

share|improve this question
It's been a long time and I'm on Linux but xcopy /s/v/e/H brings back memories. – Matt H Jun 13 '12 at 21:21
up vote 2 down vote accepted


echo F | XCOPY Z:\.vimrc %USERPROFILE%\_vimrc /H
share|improve this answer
So glad I replaced Windows with Debian. – Matt Alexander Jun 14 '12 at 0:59


type Z:\.vimrc > "%USERPROFILE%\_vimrc"
share|improve this answer

I really cannot see the problem with renaming afterwards

xcopy Z:\.vimrc %USERPROFILE%\ /H && ren %USERPROFILE%\.vimrc _vimrc

If there is a possibility of the file existing already:

    xcopy Z:\.vimrc %USERPROFILE%\ /H && ren %USERPROFILE%\.vimrc _vimrc
) ELSE (
    del %USERPROFILE%\_vimrc
    xcopy Z:\.vimrc %USERPROFILE%\ /H && ren %USERPROFILE%\.vimrc _vimrc
share|improve this answer
Seems really kludgy. Also, what if %USERPROFILE%\.vimrc existed already? – Matt Alexander Apr 12 '11 at 17:04
@mattalexx: I just edited my answer. I'm not sure what you want to do if the file exists, but you get the drift. I don't think it's kludgy, as one has to do stuff like that all the time with CMD – paradroid Apr 12 '11 at 17:18
You are duplicating the same xcopy && ren line in both "if" and "else" blocks. This could be changed to if exist ... del ... and xcopy ... && ren ..., which is much shorter. – grawity Apr 12 '11 at 21:12
@grawity: Fair point, but if you look at the edits, you'll see why I was not thinking of that. I wasn't really sure what he wanted to when the file exists already. – paradroid Apr 12 '11 at 21:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.