Dan560
asked on
.bat file does not understand ø symbol
Hi,
I have batch file that call calls a file with ø symbol in it.
If I copy and paste the script in cmd in runs fine, however from the batch script it doesnt. The ø come out like this ° , and I get and error saying it cannot find the file
can anyone help?
I have batch file that call calls a file with ø symbol in it.
If I copy and paste the script in cmd in runs fine, however from the batch script it doesnt. The ø come out like this ° , and I get and error saying it cannot find the file
can anyone help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I have a dumb question - can't you rename the called file and get rid of the undesirable character? It's bad practice to use non-standard characters in file names.
OK, now for a useful suggestion - can you modify the batch file to use the generated 8.3 short name? There is a good chance it will not include the non-standard character.
OK, now for a useful suggestion - can you modify the batch file to use the generated 8.3 short name? There is a good chance it will not include the non-standard character.
it's not a matter of displaying them though it's a matter of reading and writing them whcih should be fine reguardless of which code page you are in.
In my experiance on another script it turned out that ° was treated as a reserved character in the batch file, meaning it needs to be specifically told to evaluate it as text. What I needed to do was use the ^ escape the ° Character as so ^°.
In my case I used ^ because it was a delim in a for-loop. If you use it as a part of a file name this will work but quotes around it should also allow you to evaluate it as literal text, did you remember to put quotes around all your variables and strings?
In my experiance on another script it turned out that ° was treated as a reserved character in the batch file, meaning it needs to be specifically told to evaluate it as text. What I needed to do was use the ^ escape the ° Character as so ^°.
In my case I used ^ because it was a delim in a for-loop. If you use it as a part of a file name this will work but quotes around it should also allow you to evaluate it as literal text, did you remember to put quotes around all your variables and strings?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> "The ø come out like this ° , and I get and error saying it cannot find the file"
When pasting your code as a batch file, replace the '°' with a 'ø' by editing the code afterwards.
Hold down the left-ALT key while typing the number '0248' on the numerical keypad. When you release the ALT key, the 'ø' should appear in your text.
Typing '248' (without the leading zero) produces just a '°'.
When pasting your code as a batch file, replace the '°' with a 'ø' by editing the code afterwards.
Hold down the left-ALT key while typing the number '0248' on the numerical keypad. When you release the ALT key, the 'ø' should appear in your text.
Typing '248' (without the leading zero) produces just a '°'.
ASKER
Thanks for your help
The correct solution is to use the right code page or to edit the batch file using edit xxx.cmd from the cmd.exe prompt or other editor within the cmd.exe window (which is effectively using the same code page). Renaming the file is a bit of a cop-out. Didi you try using edit as suggested ?
In any case you should be able to "accept an answer" and split points yourself. Not sure why it has gone like this?
Steve
In any case you should be able to "accept an answer" and split points yourself. Not sure why it has gone like this?
Steve
At the moment EE has some issues with the split, which goes into auto-close with 4 days grace period instead of immediate accept. I have received several of this in the last two hours. Bug report sent.
thanks Qlemo, I did wonder what was going on after getting several of them!
Well I queried it because it came up with the "this question is being closed" and was the first I had like this with this "feature" or "bug" or whatever at the moment. Personally I think having answer as "rename the file" isn;t really a solution. The problem is down to what the other people have all said, i.e. it is how the character is represented, i.e. the very first post says to use edit (which I missed any said the same later myself) which stores the same character and should work.
But for a quiet life just leave it be.
But for a quiet life just leave it be.
I'm dismayed to find my comment (33573059) was disregarded when infact I provided a technical work-around giving the reason why you were getting the wrong symbol. If you had followed my instructions, you would NOT have had to rename your files and your batch file would have been able to process them without any worries.
See if this link helps, it talks about adding code page 865 to the O/s so Dos can see ø
http://www.uwe-sieber.de/codepage_e.html
Regards Peter