0

I have got a small script pushing text to a text file in windows, inside a .bat file.

@REM Set ups %date variable
@REM First parses month, day, and year into mm , dd, yyyy formats and then combines to be MMDDYYYY

for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%
REM :%ldt:~12,6%
REM For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b)
echo %ldt% ^| %*>>"C:\Users\Julien\Box Sync\Deversoir.txt"

I call it in a cmd windows with

 deversoir.bat "text to put in file"

I have trouble when the text contains accent : the resulting text file (deversoir.txt) has no accent, but replacement values ("é" -> "," ; "è" -> "Š" ; ...)

How can I do this ?

user1683620
  • 67
  • 2
  • 9
  • You could play with `mode con: cp select=###`, where `###` is a suitable codepage for your locale (e. g., `437`, `850`,...); consult [https://en.wikipedia.org/wiki/Code_page](https://en.wikipedia.org/wiki/Code_page) about the code pages... Or you encountered a problem with Unicode incompatibility... – aschipfl Aug 20 '15 at 09:39
  • Your question doesn't specify the required part: you should mention how this problem is different from the multitude of [similar previously asked questions](http://stackoverflow.com/search?q=Accent+%5Bbatch-file%5D) and why those solutions don't work in your case. – wOxxOm Aug 20 '15 at 10:21
  • 2
    You are right, I found my answer here [link](http://stackoverflow.com/questions/26991230/batch-creation-of-a-list-of-folders-cant-echo-accented-characters) – user1683620 Aug 20 '15 at 10:29

1 Answers1

0

Batch creation of a list of folders : can't echo accented characters

The answer is to change character encoding in batch file before outputing to text file :

chcp 1252>nul
Community
  • 1
  • 1
user1683620
  • 67
  • 2
  • 9