writeWindowsBatchScriptSync method
void
writeWindowsBatchScriptSync(
{ - required File file,
- required String contents,
- bool changeCodePage = true,
})
Implementation
@protected
@nonVirtual
void writeWindowsBatchScriptSync({
required io.File file,
required String contents,
bool changeCodePage = true,
}) {
if (!io.Platform.isWindows)
throw UnsupportedError(
"This method can only be used on Windows systems.",
);
if (changeCodePage) {
contents = """
@echo off
REM Change code page
chcp $windowsCodePage > nul
$contents
""";
}
file.writeAsStringSync(
contents,
mode: io.FileMode.writeOnly,
flush: true,
encoding: io.systemEncoding,
);
}