How would I add txt to a certin line in a txt or bat file? Say I wanted to add it to line 4...
Dim lngI As Long
Dim Autobat As Long
Dim strFile As String
Autobat = FreeFile
Open "C:\Autoexec.bat" For Input As #Autobat
strFile = Input(LOF(Autobat), #Autobat)
Close #Autobat
lngI = InStr(1, strFile, "SET %INST=", vbTextCompare)
If lngI = 0 Then
Autobat = FreeFile
Open "C:\Autoexec.bat" For Append As #Autobat
Print #Autobat, "SET %INST=" + Left(drvInstall.Drive, 1)
Close #Autobat
Else
Autobat = FreeFile
Open "C:\Autoexec.bat" For Output As #Autobat
Mid$(strFile, lngI + 10, 1) = Left(drvInstall.Drive, 1)
Print #Autobat, strFile;
Close #Autobat
End If
Dim lngI As Long
Dim Autobat As Long
Dim strFile As String
Autobat = FreeFile
Open "C:\Autoexec.bat" For Input As #Autobat
strFile = Input(LOF(Autobat), #Autobat)
Close #Autobat
lngI = InStr(1, strFile, "SET %INST=", vbTextCompare)
If lngI = 0 Then
Autobat = FreeFile
Open "C:\Autoexec.bat" For Append As #Autobat
Print #Autobat, "SET %INST=" + Left(drvInstall.Drive, 1)
Close #Autobat
Else
Autobat = FreeFile
Open "C:\Autoexec.bat" For Output As #Autobat
Mid$(strFile, lngI + 10, 1) = Left(drvInstall.Drive, 1)
Print #Autobat, strFile;
Close #Autobat
End If