O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieve Command-Line Parameters

Problem

You need to retrieve the command-line parameters that are used to execute your application.

Solution

Create a Main subroutine that accepts an array of strings. This array will be automatically populated with all command-line arguments.

Discussion

Command-line arguments are most commonly used in Console applications. In fact, many Console utilities require command-line parameters to supply a minimum amount of information. Command-line arguments are often used in document-based Windows-based applications to quickly open specific files. For example, the command winword.exe mydoc.doc could be used to launch Microsoft Word and open the mydoc.doc file in one operation.

To retrieve command-line arguments in a Windows ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required