Shell.Application Five ways to execute a command summary _vbs

Source: Internet
Author: User
When the old horse wrote this version, I tested a simple reproduction of two 2003 version, when it is easy to use. I guess it's probably about 2003 dozen ms06014 patches. Kyo the solution at the freezing point forum, I studied this component this afternoon and found that it has 5 ways to execute commands. The following is the VBS version (ASP version does not provide, how to use the ASP version in the 2003 Webshell to run the command, solve it yourself:-):
Copy Code code as follows:

Set Objshellapp = CreateObject ("Shell.Application")
Set objfolder = Objshellapp.namespace ("C:\")
objFolder.Items (). Item ("Demo.exe"). Invokeverb ' Method 1
objFolder.Items (). Item ("Demo.exe"). InvokeVerbEx ' Method 2
Objshellapp.open ("C:\demo.exe") ' Method 3

Objshellapp.shellexecute "Demo.exe", "" "," C:\ "," "," 1 "' Method 4, can add parameters and set parameter values

' Method 5
Set objFolderItem = Objshellapp.namespace ("C:\"). Items (). Item ("Demo.exe")
Set Objfivs = Objfolderitem.verbs ()
For I=0 to Objfivs.count-1
' MsgBox Objfivs.item (i)
Set OBJFIV = Objfivs.item (i)
If objfiv.name = "open (&o)" Then ' right-click menu in the Chinese system is "open (&o)", change English
Objfiv.doit
Exit for
End IF
Next
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.