AllExperts > VB Script 
Search      
VB Script
Volunteer
Answers to thousands of questions
 Home · More VB Script Questions · Answer Library  · Encyclopedia ·
More VB Script Answers
Question Library

Ask a question about VB Script
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Igor
Expertise
WSH 5.6, ADO, CDO, WMI, IE as Object.

Experience
WSH 5.6, ADO, CDO, WMI, IE as Object.

 
   

You are here:  Experts > Computing/Technology > Basic > VB Script > using the wshshell object in vbscript

VB Script - using the wshshell object in vbscript


Expert: Igor - 9/30/2004

Question
We 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


Answer
Im 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

View Follow-Ups    Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.