Sample:

Code
Function DefaultAutoexecNT($Ext,$Bak)
  If @INWIN=2 Exit 1 EndIf
  Dim $File,$FileBackup,$WL
  Dim $Handle,$OpenFile,$CloseFile
  $File = '%SYSTEMROOT%\SYSTEM32\AUTOEXEC.'+$Ext
  $FileBackup = '%SYSTEMROOT%\SYSTEM32\AUTOEXEC.'+$Bak
  If Exist($FileBackup)
  ;Assumes a valid backup already exists so we will now create all new default file
  Else
    If Exist($File)
  	  Move $File $FileBackup
  	  If @ERROR Exit @ERROR EndIf
    EndIf
  EndIf
  $WL='@echo off'+ @CRLF+
  @CRLF+
  'REM AUTOEXEC.BAT is not used to initialize the MS-DOS environment.'+@CRLF+
  'REM AUTOEXEC.NT is used to initialize the MS-DOS environment unless a'+@CRLF+
  'REM different startup file is specified in an application'+"'"+'s PIF.'+@CRLF+
  @CRLF+
  'REM Install CD ROM extensions'+@CRLF+
  'lh %SystemRoot%\system32\mscdexnt.exe'+@CRLF+
  @CRLF+
  'REM Install network redirector (load before dosx.exe)'+@CRLF+
  'lh %SystemRoot%\system32\redir'+@CRLF+
  @CRLF+
  'REM Install DPMI support'+@CRLF+
  'lh %SystemRoot%\system32\dosx'+@CRLF+
  @CRLF+
  'REM The following line enables Sound Blaster 2.0 support on NTVDM.'+@CRLF+
  'REM The command for setting the BLASTER environment is as follows:'+@CRLF+
  'REM    SET BLASTER=A220 I5 D1 P330'+@CRLF+
  'REM    where:'+@CRLF+
  'REM        A    specifies the sound blaster'+"'"+'s base I/O port'+@CRLF+
  'REM        I    specifies the interrupt request line'+@CRLF+
  'REM        D    specifies the 8-bit DMA channel'+@CRLF+
  'REM        P    specifies the MPU-401 base I/O port'+@CRLF+
  'REM        T    specifies the type of sound blaster card'+@CRLF+
  'REM                 1 - Sound Blaster 1.5'+@CRLF+
  'REM                 2 - Sound Blaster Pro I'+@CRLF+
  'REM                 3 - Sound Blaster 2.0'+@CRLF+
  'REM                 4 - Sound Blaster Pro II'+@CRLF+
  'REM                 6 - SOund Blaster 16/AWE 32/32/64'+@CRLF+
  'REM'+@CRLF+
  'REM    The default value is A220 I5 D1 T3 and P330.  If any of the switches is'+@CRLF+
  'REM    left unspecified, the default value will be used. (NOTE, since all the'+@CRLF+
  'REM    ports are virtualized, the information provided here does not have to'+@CRLF+
  'REM    match the real hardware setting.)  NTVDM supports Sound Blaster 2.0 only.'+@CRLF+
  'REM    The T switch must be set to 3, if specified.'+@CRLF+
  'SET BLASTER=A220 I5 D1 P330 T3'+@CRLF+
  @CRLF+
  'REM To disable the sound blaster 2.0 support on NTVDM, specify an invalid'+@CRLF+
  'REM SB base I/O port address.  For example:'+@CRLF+
  'REM    SET BLASTER=A0'+@CRLF
  $Handle = FreeFileHandle()
  $OpenFile = Open($Handle, $File,5)
  $WL = WriteLine($Handle,$WL + @CRLF)
  $CloseFile = Close($Handle)
  Exit @ERROR
EndFunction