I need to be able to run a command with a corospoinding file. An example...
Eveytime cat.txt shows up in folder, run notpad.exe everytime cat2.txt shows up in folder, run calc.exe
Currently the vbs below works well, but only for one file found.
FileName = "c:\vbscript\cat.txt"
Set FSO = CreateObject("Scripting.FileSystemObject")
Do
If FSO.FileExists(FileName) Then
FSO.DeleteFile FileName
CreateObject("WScript.Shell").Run "c:\windows\notepad.exe"
End If
WScript.Sleep 1000
Loop
I tried to double it like this:
FileName = "c:\vbscript\cat.txt"
Set FSO = CreateObject("Scripting.FileSystemObject")
Do
If FSO.FileExists(FileName) Then
FSO.DeleteFile FileName
CreateObject("WScript.Shell").Run "c:\windows\notepad.exe"
End If
FileName = "c:\vbscript\cat2.txt"
Set FSO = CreateObject("Scripting.FileSystemObject")
Do
If FSO.FileExists(FileName) Then
FSO.DeleteFile FileName
CreateObject("WScript.Shell").Run "c:\windows\calc.exe"
End If
WScript.Sleep 1000
Loop
However I get an expected loop error, what am I doing wrong?