Results 1 to 10 of 10

Thread: Shell Execute Help !!

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 1999
    Posts
    44

    Shell Execute Help !!

    Dear

    How can i call batch file from VB when program is run ?


    Best Regards

    Long

  2. #2
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    In the Form's Load Event
    Shell("location of a batch file")

    That what u want??
    Don't Rate my posts.

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 1999
    Posts
    44
    I've try but sometimes failed !!!


    Someone can help me ?



    Best Regards

    Long

  4. #4
    Lively Member abhaybakshi's Avatar
    Join Date
    Dec 2001
    Location
    Mumbai (INDIA)
    Posts
    81
    syntax is

    shell "program name", state.

    where state is vbhidden, vb maximised etc.
    Money is a great thing, but it can't purchase satisfaction....
    Respect money, but don't allow it to control you...

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    try this

    VB Code:
    1. Public 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
    2.  
    3. private sub command1_click()
    4. Call ShellExecute(hwnd, "Open", pathtobatchfile, "", App.Path, 1)
    5. end sub

  6. #6

    Thread Starter
    Member
    Join Date
    Jul 1999
    Posts
    44
    I've try but sometimes failed !!!


    Someone can help me ?



    Best Regards

    Long

  7. #7
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Maybe you should post your app/ or your code so that we can have a look.
    Don't Rate my posts.

  8. #8

    Thread Starter
    Member
    Join Date
    Jul 1999
    Posts
    44
    This is my sample program


    Private sub Command1_Click()

    Shell ( "C:\Connect.Bat")

    form2.show

    end sub

    Private Sub Form_Unload()

    shell ("C:\Disconnect.Bat")

    end sub



    in Do.Bat i put some coding to connect from one server with another server at difference place.

    If i run my batch file from dos it's work.



    Best Regards

    Long

  9. #9
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Well I don't know much about Batch Files but, maybe theres something wrong with them instead??
    Don't Rate my posts.

  10. #10

    Thread Starter
    Member
    Join Date
    Jul 1999
    Posts
    44
    my coding in batch file such :

    net use \\testing\ipc$ /user:dm_tester\name pass

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