PC Review


Reply
Thread Tools Rate Thread

Catch argments by running an .exe

 
 
Li Pang
Guest
Posts: n/a
 
      8th Sep 2003
Hi,

If anyone who knows how to catch the argments within
a .NET executable file? i.e. run "MyProgram.exe arg1 arg2"
and how to read arg1 and arg2 in VB.NET?

Thanks in advance
 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      8th Sep 2003
Hello,

"Li Pang" <(E-Mail Removed)> schrieb:
> If anyone who knows how to catch the argments within
> a .NET executable file? i.e. run "MyProgram.exe arg1 arg2"
> and how to read arg1 and arg2 in VB.NET?


\\\
Public Sub Main(ByVal astrCmdLineArgs() As String)
Dim i As Integer
For i = 0 To astrCmdLineArgs.Length - 1
Console.WriteLine(astrCmdLineArgs(i))
Next i
End Sub
///

-- or --

\\\
Public Sub Main()
Dim i As Integer
For i = 0 To Environment.GetCommandLineArgs().Length - 1
Console.WriteLine(Environment.GetCommandLineArgs(i))
Next i
End Sub
///

--
Herfried K. Wagner
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use event to catch the running of a macro from an add-in legacyvbc@gmail.com Microsoft Excel Programming 6 8th May 2008 12:09 AM
try..catch catch the error only running inside of VS.NET Dragos Hilbert Microsoft C# .NET 2 11th Mar 2008 03:35 PM
Determining if there are Argments in Console app Alex Microsoft VB .NET 2 12th Oct 2007 01:45 PM
Catch block is failing to catch exceptions when not run from MSDev CodeSlayer Microsoft C# .NET 2 16th Feb 2006 06:42 PM
Try Catch Question How Make it go to specific catch? needin4mation@gmail.com Microsoft C# .NET 3 10th Oct 2005 08:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:00 PM.