My.Application.CommandLineArgs

  • Thread starter Thread starter Anders B
  • Start date Start date
A

Anders B

Hmm, can "My.Application.CommandLineArgs" only contain 6 items?
I can't seem to get anything more out of it atleast.
 
Hmm, can "My.Application.CommandLineArgs" only contain 6 items?
I can't seem to get anything more out of it atleast.

I just tested it with 9 and it worked.
 
That really got me thinking..
And since I am trying Vista right now I thought, perhaps the problem lies
there..
So I tried my app on an XP box and that worked like a charm.. tried 10
arguments.

Got any clue on what it might be that limits it to 6 under Vista? Hmm.

Developing under 2005 with service pack 1.
 
It's not limited to 6 on Vista by any means.

Working quite happily with 23 on

Windows 2000 Server
Windows 2000 Workstation
Windows XP
Windows 2003 Server
Windows Vista

Perhaps yuo might like to post the command line you are using because I'm
sure that the problem is likely to be one or more of the characters in the
string.


Anders B said:
That really got me thinking..
And since I am trying Vista right now I thought, perhaps the problem lies
there..
So I tried my app on an XP box and that worked like a charm.. tried 10
arguments.

Got any clue on what it might be that limits it to 6 under Vista? Hmm.

Developing under 2005 with service pack 1.
 
Ok, a bit of background. I am using my application on the "Send to" menu
that you find when right clicking on a file in Explorer. And im picking up
the selected files with the CommandLineArgs. And its working.. but as I said
it will only give me the path of 6 files under Vista and when I tried on an
XP machine I tried up to 10 files.. will see if I can do more.
For a test I've copied a bunch of text files that im selecting and sending
to my app through the send to menu.

And right now im not doing much with the arguments in my application simply
displaying them in a messagebox.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim i As Integer
Dim s As String
For i = 0 To My.Application.CommandLineArgs.Count - 1
s = My.Application.CommandLineArgs.Item(i)
MsgBox(s)
Next
End Sub


Stephany Young said:
It's not limited to 6 on Vista by any means.

Working quite happily with 23 on

Windows 2000 Server
Windows 2000 Workstation
Windows XP
Windows 2003 Server
Windows Vista

Perhaps yuo might like to post the command line you are using because I'm
sure that the problem is likely to be one or more of the characters in the
string.
 
Forgot to add, If I select more then 6 files it wont even start my
application. Nothing happens.



Stephany Young said:
It's not limited to 6 on Vista by any means.

Working quite happily with 23 on

Windows 2000 Server
Windows 2000 Workstation
Windows XP
Windows 2003 Server
Windows Vista

Perhaps yuo might like to post the command line you are using because I'm
sure that the problem is likely to be one or more of the characters in the
string.
 
If you are providing the commandline args via the SendTo mechanism then you
obviously can't test this in the IDE.

I suggest you dump the input out to a file and see what you ACTUALLY have.

Something like:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim _ss As String = String.Empty

For Each _s As String In My.Application.CommandLineArgs
If _ss.Length > 0 The _ss &= " "
_ss &= _s
Next

Dim _sw As New IO.StreamWriter("xxx.log")

_sw.WriteLine(_ss)

_sw.Close

End Sub

Then post what you have in xxx.log here.


Anders B said:
Ok, a bit of background. I am using my application on the "Send to" menu
that you find when right clicking on a file in Explorer. And im picking up
the selected files with the CommandLineArgs. And its working.. but as I
said it will only give me the path of 6 files under Vista and when I tried
on an XP machine I tried up to 10 files.. will see if I can do more.
For a test I've copied a bunch of text files that im selecting and sending
to my app through the send to menu.

And right now im not doing much with the arguments in my application
simply displaying them in a messagebox.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim i As Integer
Dim s As String
For i = 0 To My.Application.CommandLineArgs.Count - 1
s = My.Application.CommandLineArgs.Item(i)
MsgBox(s)
Next
End Sub
 
Hello,
Ok, I made my app make a log of it.. and this is what it gets when I select
6 files. (wrote every CommandLineArg followed by a vbCrLf just so I could
read the log easier..)

D:\tmp\test - Copy (4) - Copy.txt
D:\tmp\test - Copy (6).txt
D:\tmp\test - Copy - Copy (4).txt
D:\tmp\test - Copy (5) - Copy.txt
D:\tmp\test - Copy (5).txt
D:\tmp\test - Copy - Copy (3).txt

If I select more then 6 files it wont do anything to the log.. because as I
said.. it wont start the application... no runtime or anything..
Hold on an I'll go over to my XP machine and run the program.

Oh yeah, this is weird. I run the exact same program in the exact same way
(through the sendto menu) and I just tried 38 files and it listed them all
in the log file..

So its not the limitation of ComandLineArgs.. has to be some sort of
compatibility issue with VS 2005 and Vista? hmm..


Thoughts?
 
Ok .. That doesn't help much.

Can you please dump out the result of Environment.CommandLine instead and
post the results for each platform (clearly marked) but this time, verbatim
and unedited.
 
Ok, a bit of background. I am using my application on the "Send to" menu
that you find when right clicking on a file in Explorer.

Hmmmm... I seem to recall there are some limitations on the "Send To"
command -- but now that I search for it I can't find anything. It's
bugging me because as soon as you said that (about using "Send To"), a
little light went on in my head. Argh...
 
Back
Top