
Once again there are good reasons to do this at times, but it usually isn't necessary. Why people mess about with running a command shell, wrapped around CScript, wrapped around their scripts sometimes escapes me. In your application you may not need to fuss with the path this way. This path is used both to run the WSH script and passed to the WSH script as an argument so that the WSH script knows where I want it to create test.txt for me.

That is accomplished by having the HTML page fetch and decode its full path and source file and trim it back to just the path.

This includes the test.htm, the test.vbs, and even the test.txt that is created by test.vbs when it runs. To keep things neat, I have it all in one folder. Set WSHShell = CreateObject("WScript.Shell")

Window.status = "Script has been run via WScript" Window.status = "Script has been run via CScript" For instructions, see Merge Name Mapping Files.PathParts = Split(Mid(, 2), "%")Ĭhr(CInt("&H" & Left(PathParts(X), 2))) _ If you reference a script from another project, and that script uses object names from Name Mapping, you may need to merge the external Name Mapping file with your local Name Mapping file. For more information about this, see Sharing Project Items and Their Child Elements Among Several Projects.

To be able to work with elements that reside within external projects, import them to or share them with the current project. These elements remain available only for the project the unit is imported from. The USEUNIT statement does not copy, share, or merge project items. For instance, if you need to call scripts declared in UnitA from UnitB, and to call scripts declared in UnitB from UnitA, you must add references to both units. VBScript allows script units to refer to each other with circular references. Scripts declared in a fourth unit and greater cannot be called in the current unit using VBScript.
