Results 1 to 4 of 4

Thread: [RESOLVED] How do you on a command click shell and run a .vbs file?

  1. #1

    Thread Starter
    Fanatic Member newprogram's Avatar
    Join Date
    Apr 2006
    Location
    in your basement
    Posts
    769

    Resolved [RESOLVED] How do you on a command click shell and run a .vbs file?

    I tried
    gf Code:
    1. Dim ReturnValue
    2. ReturnValue = Shell("C:\Documents and Settings\Administrator\Desktop\dial2.VBS", 1) ' Run Calculator.
    3. AppActivate ReturnValue
    and this to
    f Code:
    1. Shell("C:\Documents and Settings\Administrator\Desktop\dial2.VBS")
    and this
    h Code:
    1. Shell "C:\Documents and Settings\Administrator\Desktop\dial2.VBS"
    Live life to the fullest!!

  2. #2
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: How do you on a command click shell and run a .vbs file?

    Use ShellExecute.


    Code:
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
                                                                           ByVal lpOperation As String, _
                                                                           ByVal lpFile As String, _
                                                                           ByVal lpParameters As String, _
                                                                           ByVal lpDirectory As String, _
                                                                           ByVal nShowCmd As Long) As Long
    Const SW_SHOWNORMAL = 1
    
    Private Sub Command1_Click()
        ShellExecute Me.hwnd, vbNullString, "C:\Documents and Settings\Administrator\Desktop\dial2.VBS", vbNullString, "C:\", SW_SHOWNORMAL
    End Sub

  3. #3

    Thread Starter
    Fanatic Member newprogram's Avatar
    Join Date
    Apr 2006
    Location
    in your basement
    Posts
    769

    Re: How do you on a command click shell and run a .vbs file?

    Thank you!!! that works great!!!
    Quote Originally Posted by zynder
    Use ShellExecute.


    Code:
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
                                                                           ByVal lpOperation As String, _
                                                                           ByVal lpFile As String, _
                                                                           ByVal lpParameters As String, _
                                                                           ByVal lpDirectory As String, _
                                                                           ByVal nShowCmd As Long) As Long
    Const SW_SHOWNORMAL = 1
    
    Private Sub Command1_Click()
        ShellExecute Me.hwnd, vbNullString, "C:\Documents and Settings\Administrator\Desktop\dial2.VBS", vbNullString, "C:\", SW_SHOWNORMAL
    End Sub
    Live life to the fullest!!

  4. #4
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: [RESOLVED] How do you on a command click shell and run a .vbs file?

    No problem buddy.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width