CodeItBetter Programming Another VB Programming Blog

How to Add a command to Autoexec.bat

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'System & API - How to Add a command to Autoexec.bat
'Open the file Autoexec.bat for Append and write the new command.

Private Sub cmdAdd_Click()
    Dim fnum As Integer
    Dim strTxt As String
 
    ' Open the file for append.
    fnum = FreeFile
    Open "C:\autoexec.bat" For Append As fnum
 
    ' Add the command.
    strTxt = txtCommand.Text
    Print #fnum, strTxt
 
    ' Close the file.
    Close fnum
 
    MsgBox "Done."
End Sub

Related posts:

  1. How to replace a line for particular line number
  2. Search & Delete the Line for Given Search String in a text file
  3. How to Export an Access Database to HTML file
  4. How to Search & Replace the Line for Given Search String in a text file
  5. How to write text in a given text file (in three ways)
  6. How to get the command line arguments using the Command() function?
  7. How to merge two text files
  8. How to add contents of text file to a list box
  9. How to I create a text file from part of another text file (for given line numbers like Line No. 2 to 7)
  10. How to Extract each and every word individually from a text file

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.