vbscript - Constantly look for file, when file exist, run command -


i need vbscript monitors folder specific file, when file found needs execute command delete file continue monitor folder again same file incase needs run again.

this...

set fso = createobject("scripting.filesystemobject") while 1>0    if fso.fileexists (file.txt)         fso.deletefile (file.txt)        createobject("wscript.shell").run "c:\windows\notepad.exe"    end if    wscript.sleep 1000 loop 

gave me "object required: file" error

update, worked...

filename = "c:\vbscript\cat.txt" set fso = createobject("scripting.filesystemobject")    if fso.fileexists(filename)         fso.deletefile filename        createobject("wscript.shell").run "c:\windows\notepad.exe"    end if    wscript.sleep 1000 loop 

simply create script infinitely loops, testing file existence , if delete it.

filename = "path\to\filename" set fso = createobject("scripting.filesystemobject")    if fso.fileexists(filename)         fso.deletefile filename    end if    wscript.sleep 1000 loop 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -