I'm writing a file via cmd:
Code: Select all
@echo off
chcp 65001
echo Fred > Output.txt
echo Barney >> Output.txt
Code: Select all
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=#CURRENTPATH#CreateOutput.cmd
State=Hide
OutputType=ANSI
OutputFile=#CURRENTPATH#CreateOutput.log
Code: Select all
local p = assert(io.open('Output.txt', 'r'))
content = p:read('*all')
print('File content: ' .. content)
p:close()
Code: Select all
DBUG (10:31:34.003) : File content: F
Code: Select all
Parameter=cmd /u /c #CURRENTPATH#CreateOutput.cmd
I also tried to write everything to stdout and read from the Log, since that is ansi or UTF8 according to the specified OutputType. But when I do that, only the first letter of my echo goes into the log. Of course, the batch output is perfectly fine when I run it from windows.
(I gotta say, once again I wished Unicode had never happened... so often it seems to be more trouble than it's worth, and I'd gladly give up my äöü. I don't need them that much, really.)
Did I miss something? I also went through os.execute() (annoyingly flashes a cmd window, otherwise fine) and tried os.popen() for a while until I realised it's not implemented, alas.
This is Windows 10 and Rainmeter 4.5.16.3687 (64-bit).