AllExperts > Experts 
Search      

VB Script

Volunteer
Answers to thousands of questions
 Home · More 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

Topic: VB Script



Expert: Igor
Date: 9/30/2004
Subject: using the wshshell object in vbscript

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

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.