Re: Format floppy thru VB

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Fosco (fake_at_fake.invalid)
Date: 03/04/04


Date: Thu, 04 Mar 2004 06:16:00 GMT


"Sunil Gosavi"
> Thanks, but this method shows the dialog box, i need
> to do it without user interventions.

Private Sub Form_Load()
Dim cmd As String
Const STAY = " /K "
Const NOSTAY = " /C "
  cmd = "format.com /q /autotest A:"
  Shell Environ("COMSPEC") & NOSTAY & cmd, vbHide
  Unload Me
End Sub

> What i need actually is...
> I need to read and write a txt file in floppy

'*.vbs (FileSystemObject)

Const ForReading = 1, ForWriting = 2, ForAppending = 8
sLogFile = "A:\Test.log"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oLogFile = oFSO.OpenTextFile(sLogFile, 2, True, 0)
oLogFile.WriteLine "AAAAAA"
oLogFile.WriteLine "BBBBBB"
Set oLogFile = oFSO.OpenTextFile(sLogFile, 1, True, 0)
      sAll = oLogFile.ReadAll
    Msgbox sAll

--
Fosco


Relevant Pages