shell ("notepad.exe c:\file.cfg")

解决方案 »

  1.   

    我不是要打开文件,只是要用fso的getfile方法,以便可以在程序中读取文件内容
      

  2.   

    Dim ff 
    ff = "c:\boot.ini"
    Open ff For Input As #1
    Dim str
    str = Input(FileLen(ff), #1)
    MsgBox str
      

  3.   

    用fso 的Private Sub Command1_Click()
        Const ForReading = 1, ForWriting = 2, ForAppending = 3
        Set fs = CreateObject("Scripting.FileSystemObject")
        Set f = fs.OpenTextFile("c:\testfile.txt", ForReading, TristateFalse)
        MsgBox f.ReadAll
        f.Close
    End Sub
      

  4.   

    小呆,如果你打开的这个程序不是testfile.txt,而是testfile.cfg或者其他记事本程序不认识的后缀,又怎么打开呢?fso好像不会自动全部用记事本打开
      

  5.   

    你试试就知道 无论 什么testfile.cfg 还是 testfile.gif 
    testfile.ooo   testfile都按文本打开
      

  6.   

    你看下面这段源代码,如果不用
          EinfoFilePath = "c:\einfo.cfg"
          CopyEinfoFilePath = "c:\einfo.txt"
          FSO.CopyFile EinfoFilePath, CopyEinfoFilePath, True
          Set FileO_3 = FSO.GetFile(CopyEinfoFilePath)
          Set TS = FileO_3.OpenAsTextStream(ForReading)
          LoopStep = 0
          Do While LoopStep < 4
            TS.SkipLine
            LoopStep = LoopStep + 1
          Loop
          EinfoFileConcent = TS.ReadLine
    如果不把后缀改成.txt的话,确实就读不出东西
      

  7.   

    Private Sub Command1_Click()
    Dim FSO As New FileSystemObject
    Set FileO_3 = FSO.OpenTextFile("c:\einfo.cfg", ForReading, TristateFalse)
          MsgBox FileO_3.ReadAll
    End Sub
    你要读什么