EnableExplicit Define fOutput$ = "output.txt" ; enter path of file to create or overwrite Define str$ = "This string is to be written to the file" If OpenConsole() If CreateFile(0, fOutput$) WriteString(0, str$) CloseFile(0) Else PrintN("Error creating or opening output file") EndIf PrintN("Press any key to close the console") Repeat: Delay(10) : Until Inkey() <> "" CloseConsole() EndIf