473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.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.
Dec 26 '07 #1
3 2081
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.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.
Dec 26 '07 #2
On Dec 26, 9:42 pm, Tim A <T...@discussions.microsoft.comwrote:
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.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.
This question is being asked so frequently nowadays :-)

Look at these recent posts:

http://groups.google.com/group/micro...4ca711a0?hl=en
http://groups.google.com/group/micro...8779ae09?hl=en
Dec 26 '07 #3
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.

"kimiraikkonen" wrote:
On Dec 26, 9:42 pm, Tim A <T...@discussions.microsoft.comwrote:
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.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.

This question is being asked so frequently nowadays :-)

Look at these recent posts:

http://groups.google.com/group/micro...4ca711a0?hl=en
http://groups.google.com/group/micro...8779ae09?hl=en
Dec 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Fred Iannon | last post by:
All, I have developed an application that needs to run in one of two modes: (1) IF NO command line parms are provided I would like it to run as a Window form application (i.e. /target:winexe)...
4
by: jabailo | last post by:
This is driving me crazy. I finally got the Remoting sample chat application working almost. When I run the chat client in VS.NET it goes into an endless loop -- that's because I assume that...
1
by: Michael Hetrick | last post by:
How would I pass parameters to a console application? I would like to do something like this: consoleapp.exe /o \\fileshare\origindirectory /d \\fileshare\destinationdirectory I'm not sure...
6
by: Mark Allison | last post by:
Hi, I have an application that I want to be to run in Console mode and GUI mode. If no params are entered, I want the GUI fired up, if params are entered, then go into console mode. I believe...
17
by: MumboJumbo | last post by:
Hi I have a really basic question hopefully some can help me with: Can you write a (i.e. one) C# project that works from the cmd line and gui? I seems if i write a GUI app it can't write to...
4
by: eduardorp1 | last post by:
I have a GUI application that needs to be invoked from the command line as well. It should work both as a GUI and as a console application. When I invoke it from the command line, it reads all...
6
by: vijai.kalyan | last post by:
Hello, I wrote a trivial program to set the console title in a console application. Here is the code:- namespace myns { class SetTitle { static void Main ( string args )
2
by: Dave | last post by:
Can you create your own switches or attributes for a console app to specify specific arguments? In other words, specify a /f to represent the "from date" and /t as "to date"? if I need to supply...
3
by: Alex | last post by:
Hello, I'm wroting a console utility in VB 2005, and I need the ability to pass parameters to the application when the program runs. For example, if my program is called testing.exe, I need to...
1
by: TuckerRoth | last post by:
This is my first post on this site, so I don't know the rules. Please correct me if this gets to the wrong folks...etc. PROBLEM: Many of the apps that I am writing need to be able to run 2 ways:...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.