Skip to content

Execute VBS Scripts

This refers the the Execute Application Plugin.

UPDATE: Specifics around which executable to use have been alleviated in v2.7.0.8. Directory Monitor will now determine the application that is used by default (by the shell) to execute the file you specify. Basically, if you specify a VBS file to execute, Directory Monitor will automatically correct this for you and replace the "Execute" file and "Parameters" appropriately to the defaults on your system.

For Directory Monitor < 2.7.0.8:
Directory Monitor v1 used the shell to execute so you could specify any file type and Windows would use the registered application for that extension to execute it. When you hide the application (running in the background) you cannot use the shell which caused inconsistent behavior for users when they could execute things without fail when the window was displayed, but it broke when they hide it. On top of that, you could crash explorer (losing your start bar and right click menus) if something went wrong with the shell execution.

For this reason I have made things consistent in v2, nothing executes with the shell and Directory Monitor is responsible for crashing apps and infinite looping scripts. It also enables me to time-out long running apps and allows users to be quite specific about what they want to use to execute things. So, after that long winded explanation, what you really need to do is specify the application you want to use to execute the script and not the script itself...

Windows will directly execute .exe, .bat and .com files since they don't require an actual application to open. To open an Excel file you need MS Excel, a PDF needs Adobe reader of some other variant. Shell execution will know what the file types open with and infer the execution for you. .vbs files are not handled directly by Windows, they are run by CSCRIPT.exe by default so that is actually what you need to execute, passing in your script as a parameter/argument. Here is an example of running MyScript.vbs from Directory Monitor and passing in the file as the first argument to the script:



Hope this clears up the confusion with why VBScripts cannot be executed directly. Another option is to wrap the script calls in a batch file (which will use shell execution by default) and execute that directly.

Feedback and Knowledge Base