VB Script/using the wshshell object in vbscript
Expert: Igor - 9/30/2004
QuestionWe have an ASP page where we want to run a vb script to execute an external command and then return to ASP...
I did some research and found the wshShell object - and it has a .run method that will do the trick.
Problem is, I have the following source code using VBScript that uses this functionality and I do not know what "references" I need in a project in order to use this object. Can you help?
The code to open a copy of the currently running script is as follows...
set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.run "%windir%\notepad " & Wscript.ScriptFullname
Questions... What references do I need in order to access the methods of the Wscript and WshShell objects?
Thanks,
Brad
AnswerIm not specialist with ASP (WSH only) but you can try like this
JScript:
<% var objMyObject = Server.CreateObject("Scripting.FilesystemObject"); %>
VBScript:
<% Set objMyObject = Server.CreateObject("Scripting.FilesystemObject") %>
Of course in the raw scripts <% %> will not present.
I was glad to answer