Summary of five methods for Shell. Application to execute commands

Source: Internet
Author: User

When I first wrote this version by Ma, I tested the simplified and traditional versions 2003, which should be easy to use. I guess it is probably related to the patch ms06014 on 2003. Parse proposed a solution in the freezing point forum. I studied this component this afternoon and found that it has five methods to execute commands. The following is the vbs version (asp version is not provided. You can use asp version to run commands in webshell 2003 :-): Copy codeThe Code is 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. You 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 the menu and choose "open (& O)" in the Chinese system.
ObjFIV. DoIt
Exit
End IF
Next

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.