Results 1 to 3 of 3

Thread: [RESOLVED] Simple question - How to call open a file?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Resolved [RESOLVED] Simple question - How to call open a file?

    Hi all,

    Simple question - I've tried the solutions that i've seen using search on this forum (incidentally, the search function keeps lagging out and/or crashing my browser..) but I can't get it working; I keep getting errors.

    Simply, how can I open a fixed-name / location file from within VB code?

    So say I have "C:\Update.bat" (it's a batch file that I'm trying to open). What's the exact code to open "C:\Update.bat" ?

    I've tried:
    Code:
    Shell "Start /wait " & "Update.bat"
    and
    Code:
    Shell "Start /wait C:\Update.bat"
    Thanks

  2. #2
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: Simple question - How to call open a file?

    do u want to open to read the file or do u want to run the file?
    to open and read the file use this code
    VB Code:
    1. open "c:\update.bat" for input as #1
    2. do while not eof(1)
    3. input #1, myString
    4. text1.text=text1.text & vbcrlf & mystring
    5. loop
    6. close #1

    to runt the file just use
    VB Code:
    1. shell "c:\update.bat"

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: Simple question - How to call open a file?

    Ah! Perfect (To open the file to execute it). Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width