Results 1 to 3 of 3

Thread: [RESOLVED] passing parameters to exe

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337

    Resolved [RESOLVED] passing parameters to exe

    How would one go about sending parameters to the application?

    For example, I want to send my exe some switches or parameters.

    my_app.exe -param1 -param2

    Something like that. Then I can use the para1 and param2 throughout the exe

    Possible?

    But it is not command line, it is gui based

  2. #2
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: passing parameters to exe

    You could use a Windows shortcut with params and then examine them as follows.

    Code:
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            If My.Application.CommandLineArgs.Count > 0 Then
                For Each cmd In My.Application.CommandLineArgs
                    Console.WriteLine("{0}", cmd)
                Next
            End If
        End Sub

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337

    Re: passing parameters to exe

    very cool, thank you Kevin.

    Worked like a charm.

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