example
mode con: cp>%tmp%\output.tmp
notepad %tmp%\output.tmp
show:
Statut du p‚riph‚rique CON:
---------------------------
Page de codesÿ: 850
instead of:
Statut du périphérique CON:
---------------------------
Page de codes : 850
I also tried with chcp 65001
and 1252
Do you know a fix?
Edit:
I use the truetype Lucida fonts, and even if I do type %tmp%\output.tmp
it shows the right characters in console, but not in any text editor.
I also tried:
cmd /U /C "chcp 65001>nul &mode con: cp>%tmp%\output.tmp"
and
cmd /A /C "chcp 65001>nul &mode con: cp>%tmp%\output.tmp"
without success
Redirect Output from the Windows Command Line to a Text File. When you type a command on the Windows command line, the output from the command is displayed in the command prompt window. For some commands, the output can be several rows long and sometimes longer than the height of the command window, causing you to scroll to view all of the output.
For example: suppose we want to run a command called “date” if we run it will print the output to the current terminal screen. But our requirement is different, we don’t want the output to be displayed on the terminal. We want the output to be saved in a file. This could be done very easily with output redirection.
When running a Batch file, the command is executed in cmd.exe. The output of these commands is obtained in two streams, i.e., standard output and standard error. These outputs can be either redirected to separate files or a single file. A redirection operator is denoted by >. By default, the cmd uses > for the standard output, the same as 1>.
Redirection here simply means diverting the output or input. Similarly, if we have a command that needs input to be performed. Let take a command “head” this needs input to give output.
You may use the /U switch of cmd.exe
in order to output Unicode characters. For example:
cmd /U /C dir > dirInUnicode.txt
However, this switch works on internal commands only, so you must use an auxiliary file in order to convert the output of mode
command:
mode con: cp>%tmp%\output1.tmp
cmd /U /C type %tmp%\output1.tmp > %tmp%\output2.tmp
Use PowerShell instead of DOS as a command line prompt. Its works flawlessly with special characters.
C:> powershell
PS C:> mode con: cp > temp.txt
PS C:> notepad temp.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With