Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

this is the code of my .bat file:

@echo off
xcopy "C:\Users\Administrator\věc" "C:\věc"  /e /i /h
echo Done
pause

However it says:File not found - výc. See ě char changed into ý

Why is it so? Thanks

Edit: I'm trying to copy directory, not a file

share|improve this question
    
I don't know how you are getting any results at all. I copied your text into notepad and hit save. There is a option for enocding. If you select ANSI, the ě becomes e. If you select Unicode or UTF-8, cmd throws garbage. eg:' C:\Users\ben>∩╗┐@echo off '∩╗┐@echo' is not recognized as an internal or external command, operable program or batch file." etc, etc. –  Ben L May 14 '13 at 16:08
    
well in my machine it becomes ý... It may be because of some local settings? I don't know, however it doesn't really matter whether it's ý or e –  simPod May 14 '13 at 20:14

3 Answers 3

One option is to use a wildcard character for your locations:

xcopy "C:\Users\Administrator\v*c" "C:\v*c"  /e /i /h

It may not be ideal, but it'll work under a few conditioms.

  1. No other folders could match the expression 'v (any characters) c' (such as vehdgthc), that is true in the src and dest.

  2. The dir on c already exists for the dest.

share|improve this answer
    
Your answer is great as it clearly states any short comings too. +1 –  Dave May 14 '13 at 14:46
    
Well, now it does this: File not found - v*c –  simPod May 14 '13 at 14:49
    
This is odd - it should be looking for a folder. It appears that although using the wildcard, the XCOPY is reading the special character so the same issue persists –  Dave May 14 '13 at 14:50
    
Try not using " " with wild characters. It's been a while since I don't use Windows but I guess it has the same effect of ' ' in most operating systems and programming languages. –  Alex May 14 '13 at 15:28

This is due to unicode and more about how the special character is displayed. Unicode characters will display differently in Notepad and Wordpad for example.

In your case, it appears this special character is confusing the XCopy command and making it think it is a file, and not a folder.

If it is an option, change it to an e and then try it again. I appreciate it's not ideal as you're having to create a new word but this should work. If it does, then you know the issue is with the character, if not then obviously you'll need to investigate further.

Edit

I can't test this, but you could try Robocopy (not sure what OS you're using)

robocopy" C:\Users\Administrator\věc" "C:\věc"

EDIT 2

Or, the issue is, your machine is not showing you file extensions, so you think your file is věc . It is not likely! Your file should be name dot extensions

EG

věc.txt or věc.pdf
share|improve this answer
    
Well, I don't want to change the name of my file but it's the problem with that character, for sure. Using wild card is elegant workaround but it's still just workaround, I'd prefer clean solution though. Thanks for your responses anyway! –  simPod May 14 '13 at 14:42
    
@simPod, can you try using Robocopy (if applicable) and see if the issue persists? –  Dave May 14 '13 at 14:48
    
Using Robocopy: ERROR : Invalid Parameter #1 : "C:\Users\Administrator\v*c" –  simPod May 14 '13 at 14:51
    
@simPod - see my Edit 2 –  Dave May 14 '13 at 14:52
    
Saw, see my Edit ;) –  simPod May 14 '13 at 14:53

In your editor, make sure you use Ansi encoding, not OEM.

share|improve this answer
    
I'm using ANSI, it's notepad –  simPod May 14 '13 at 15:05
    
What default ANSI encoding do you have set in Windows? –  Martin Prikryl May 15 '13 at 6:13
    
Where can i find out? –  simPod May 17 '13 at 16:24
    
Depends on your version of Windows. For instance on XP, it's Control Panel > Regional and Language Options > Advanced tab > Language for non-Unicode programs –  Martin Prikryl May 20 '13 at 9:12

Your Answer

 
discard

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.