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
Post a Comment