Sending accented characters to Clipboard from a batch file
I’ve been trying to find a solution to this, but I wrote a basic program to automatically produce an “outage” report more or less, that I need copied into the clipboard so that I can paste it into a mainframe system. It needs to be in English and French, but the French accents are not copying properly… Is there anyway around this – to include the variables?
The output will basically be this le système ne
(clipped out the rest).
Any assistance would be greatly appreciated.
This is that I have so far:
if "%SRSST%"=="n" ( ( echo *** IMSNEWS *** echo. echo On Sunday, %DATEME% %DT%%DATEST% %DATEYR%, There will be no echo system outage. ) | Clip )else ( echo *** IMSNEWS *** echo. echo On Sunday, %DATEME% %DT%%DATEST% %DATEYR%, the system will not echo be available between %SRSST% - %SRSET% for regular echo weekly maintenance. ) | Clip timeout /t 5 if "%SRSST%"=="n" ( ( echo *** NOUVELLES *** echo. echo Le dimanche %DT% %DATEME%, %DATEYR%, Il n'y aura pas echo d'interruption du système ) | Clip )else ( echo *** NOUVELLES *** echo. echo Le dimanche %DT% %DATEME%, %DATEYR%, le système ne echo sera pas disponible entre %SRSST% - %SRSET% pour la echo maintenance hebdomadaire. ) | Clip goto Menu
Answer
After further investigation the issue was strange – Using chcp 1252
In a test.cmd – would work…. but for some reason would not work in me larger batch file. (I have honestly no idea why as I copied the text code for code
:TST @echo off cls chcp 1252 echo d'interruption du système | CLIP pause goto Menu
However I found that adding the line chcp 65001
Worked for everything.
:TST @echo off cls chcp 65001 echo d'interruption du système | CLIP pause goto Menu
Hopes this helps out.