console app command line args

T

Tim A

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.GetCommandLineArgs()
Console.WriteLine(files.Length)
If files.Length > 1 Then
i = 0
For Each s As String In My.Application.CommandLineArgs
Console.WriteLine(s)
Next
Console.ReadLine() 'this temporary to keep the console window open
End If
End Sub
End Module

Thanks for your assistance.

t.
 
T

Tim A

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.
 
K

kimiraikkonen

T

Tim A

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top