+ Reply to Thread
Results 1 to 2 of 2

Thread: check if folder exist

  1. #1
    Junior Member
    Join Date
    May 2012

    check if folder exist

    I want to make a script thtat will look for a folder : C:\foldername
    I would like the script to run a exe file if the folder is not running
    and the exe file is : C:\system\file.exe

    Any suggestion ?

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Try that script :
    Option Explicit
    Private Const Folder As String = "c:\foldername"
    Private Const FileToRun As String = "C:\system\file.exe"
    Sub Run(ByVal sFile)
        Dim shell
        Set shell = CreateObject("WScript.Shell")
        shell.Run Chr(34) & sFile & Chr(34), 1, False
        Set shell = Nothing
    End Sub
    Dim fs
    Set fs = CreateObject("Scripting.FileSystemObject")
    If Not fs.FolderExists(Folder) Then
       Run FileToRun
    End If

+ Reply to Thread


Posting Permissions

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