VB script, real simple IF question

Discussion in 'OT Technology' started by 127.0.0.1, Jun 18, 2007.

  1. 127.0.0.1

    127.0.0.1 New Member

    Joined:
    Sep 7, 2003
    Messages:
    9,310
    Likes Received:
    0
    Location:
    Fort Worth, Texas
    basically, I want to make it so when the script runs, it looks for the .ini file that is being modified by the script. If it finds the .ini file, the script goes ahead and runs, but if the .ini file isn't found, the script quits there.

    What's the easiest way to do that.

    C:\Program Files\eCopy\Desktop\Bin\mr2000.ini

    That's the file I'm trying to see if it's there.

    I think I explained it well enough.

    If the script finds the file, then go ahead, if the script doesn't find the file, then stop.

    I know how to make it so if the script finds the file, then it stops...but i don't know how to make it go the other way around.

    Thanks
     
  2. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    Either use an Else clause, or use NOT.
     
  3. 127.0.0.1

    127.0.0.1 New Member

    Joined:
    Sep 7, 2003
    Messages:
    9,310
    Likes Received:
    0
    Location:
    Fort Worth, Texas
    could you show me?
    This is currently how I have it set up, and it seems to work.
    Code:
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    strFileName = "C:\Program Files\eCopy\Desktop\Bin\mr2000.ini"
    If objFSO.FileExists("C:\Program Files\eCopy\Desktop\Bin\mr2000.ini") Then
     msg = filespec & "Exists."
    Else
     wscript.quit
    End If
     
  4. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    that looks good enough.
     

Share This Page