writeWindowsBatchScript method
Future<void>
writeWindowsBatchScript(
{ - required File file,
- required String contents,
- bool changeCodePage = true,
})
Implementation
@protected
@nonVirtual
Future<void> writeWindowsBatchScript({
required io.File file,
required String contents,
bool changeCodePage = true,
}) async {
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
""";
}
await file.writeAsString(
contents,
mode: io.FileMode.writeOnly,
flush: true,
encoding: io.systemEncoding,
);
}