473,804 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
Dec 26 '07 #1
3 2101
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.
Dec 26 '07 #2
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:

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.

"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:

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
1645
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) with a Main form, etc. and with execution returing to the command line AS SOON AS the program STARTS (2) If a command line parm IS provided I would
4
2227
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 there is now way for me to interface to a Console.ReadLine(). However, when I run it in the cmd window, it does not output any Console.WriteLine()s ( even the "Hello" that I put as the first
1
18281
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 how to start the console app to read from the command line. Any assistance would be appreciated! Michael Hetrick
6
3237
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 I have all the code set up to do this, however when I issue a Console.WriteLine instruction, nothing gets written to the console. In fact, the command prompt comes back before the program has finished executing. What do I need to do?
17
4241
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 console using System.Console.WriteLine if thge project has its "Output Type" to "Windows Application". However I can write to stdio if i set output type to "Console Application". When I do this I unfortunately get a "console box" as well
4
8632
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 the command line options perfectly. However, I can't use Console.WriteLine to write messages to the console (the lines don't appear at the console window). Is it possible? What should I do to "connect" the console? My Main() is:
6
4907
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
7579
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 both? Thanks, Dave
3
10117
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 be able to run this: c:\testing.exe c:\test ....and have 'c:\test' passed to the program as a variable. Most of my VB books focus on web forms or windows forms, but not much details on console
1
5969
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: They might be invoked from the command-line with parameters so that they do not show UI, but accomplish some task; OR they might be double-clicked, in which case they show a UI (so that the User can configure settings for the app...etc.). To...
0
9593
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9169
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.