console app command line args

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?VGltIEE=?=

    #1

    console app command line args

    I want the user to be able to select a group of files in windows explorer,
    right click, open with - my application and have my application put all of
    the file names onto the clipboard.

    It seems that the command line args is only capturing the last file selected
    when the app is executed. files.length is always equal to 2 no matter how
    many files are selected when the app is run. Is there another way to do this?

    Module Module1
    Sub Main()
    Dim i As Integer
    Dim files As String() = Environment.Get CommandLineArgs ()
    Console.WriteLi ne(files.Length )
    If files.Length 1 Then
    i = 0
    For Each s As String In My.Application. CommandLineArgs
    Console.WriteLi ne(s)
    Next
    Console.ReadLin e() 'this temporary to keep the console window open
    End If
    End Sub
    End Module

    Thanks for your assistance.

    t.
  • =?Utf-8?B?VGltIEE=?=

    #2
    RE: console app command line args

    Creating a shortcut in the send to folder fixes the problem as described in
    the post "Opening multiple files with my application". This is a good work
    around for now. Does anyone know why windows does this?

    Thanks!

    t.

    "Tim A" wrote:
    I want the user to be able to select a group of files in windows explorer,
    right click, open with - my application and have my application put all of
    the file names onto the clipboard.
    >
    It seems that the command line args is only capturing the last file selected
    when the app is executed. files.length is always equal to 2 no matter how
    many files are selected when the app is run. Is there another way to do this?
    >
    Module Module1
    Sub Main()
    Dim i As Integer
    Dim files As String() = Environment.Get CommandLineArgs ()
    Console.WriteLi ne(files.Length )
    If files.Length 1 Then
    i = 0
    For Each s As String In My.Application. CommandLineArgs
    Console.WriteLi ne(s)
    Next
    Console.ReadLin e() 'this temporary to keep the console window open
    End If
    End Sub
    End Module
    >
    Thanks for your assistance.
    >
    t.

    Comment

    • kimiraikkonen

      #3
      Re: console app command line args

      On Dec 26, 9:42 pm, Tim A <T...@discussio ns.microsoft.co mwrote:
      Creating a shortcut in the send to folder fixes the problem as described in
      the post "Opening multiple files with my application". This is a good work
      around for now. Does anyone know why windows does this?
      >
      Thanks!
      >
      t.
      >
      "Tim A" wrote:
      I want the user to be able to select a group of files in windows explorer,
      right click, open with - my application and have my application put all of
      the file names onto the clipboard.
      >
      It seems that the command line args is only capturing the last file selected
      when the app is executed. files.length is always equal to 2 no matter how
      many files are selected when the app is run. Is there another way to do this?
      >
      Module Module1
      Sub Main()
      Dim i As Integer
      Dim files As String() = Environment.Get CommandLineArgs ()
      Console.WriteLi ne(files.Length )
      If files.Length 1 Then
      i = 0
      For Each s As String In My.Application. CommandLineArgs
      Console.WriteLi ne(s)
      Next
      Console.ReadLin e() 'this temporary to keep the console window open
      End If
      End Sub
      End Module
      >
      Thanks for your assistance.
      >
      t.
      This question is being asked so frequently nowadays :-)

      Look at these recent posts:



      Comment

      • =?Utf-8?B?VGltIEE=?=

        #4
        Re: console app command line args

        Thanks, it was your post that led me to the work around. I had done some
        initial searching but didn't see anything. the behavior is strange. Even in
        the send to folder the results are inconsistant. Sometimes I get all of the
        files, sometimes I only get one.

        t.

        "kimiraikko nen" wrote:
        On Dec 26, 9:42 pm, Tim A <T...@discussio ns.microsoft.co mwrote:
        Creating a shortcut in the send to folder fixes the problem as described in
        the post "Opening multiple files with my application". This is a good work
        around for now. Does anyone know why windows does this?

        Thanks!

        t.

        "Tim A" wrote:
        I want the user to be able to select a group of files in windows explorer,
        right click, open with - my application and have my application put all of
        the file names onto the clipboard.
        It seems that the command line args is only capturing the last file selected
        when the app is executed. files.length is always equal to 2 no matter how
        many files are selected when the app is run. Is there another way to do this?
        Module Module1
        Sub Main()
        Dim i As Integer
        Dim files As String() = Environment.Get CommandLineArgs ()
        Console.WriteLi ne(files.Length )
        If files.Length 1 Then
        i = 0
        For Each s As String In My.Application. CommandLineArgs
        Console.WriteLi ne(s)
        Next
        Console.ReadLin e() 'this temporary to keep the console window open
        End If
        End Sub
        End Module
        Thanks for your assistance.
        t.
        >
        This question is being asked so frequently nowadays :-)
        >
        Look at these recent posts:
        >


        >

        Comment

        Working...