ConsoleApplicationBase.CommandLineArgs プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ConsoleApplicationBase.CommandLineArgs プロパティの意味・解説 

ConsoleApplicationBase.CommandLineArgs プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

現在のアプリケーションコマンド ライン引数文字列として格納されコレクション取得します

名前空間: Microsoft.VisualBasic.ApplicationServices
アセンブリ: Microsoft.VisualBasic (microsoft.visualbasic.dll 内)
構文構文

Public ReadOnly Property
 CommandLineArgs As ReadOnlyCollection(Of
 String)
Dim instance As ConsoleApplicationBase
Dim value As ReadOnlyCollection(Of
 String)

value = instance.CommandLineArgs
public ReadOnlyCollection<string> CommandLineArgs
 { get; }
public:
property ReadOnlyCollection<String^>^ CommandLineArgs {
    ReadOnlyCollection<String^>^ get ();
}
/** @property */
public ReadOnlyCollection<String> get_CommandLineArgs ()
public function get CommandLineArgs
 () : ReadOnlyCollection<String>

プロパティ
現在のアプリケーションコマンド ライン引数文字列として格納された、String の ReadOnlyCollection。

解説解説

詳細については、Visual Basicトピック「My.Application.CommandLineArgs プロパティ」を参照してください

My.Application.CommandLineArgs プロパティは、現在のアプリケーションコマンド ライン引数対す読み取り専用アクセス提供します。ただし、ClickOnce配置されるアプリケーションには使用できません。

単一インスタンス アプリケーション場合My.Application.CommandLineArgs プロパティは、最初インスタンスコマンド ライン引数返します単一インスタンス アプリケーションに対して複数インスタンス生成し2 番以降インスタンス引数アクセスするには、My.Application.StartupNextInstance イベント処理して、StartupEventArgs 引数CommandLine プロパティ調べる必要があります

メモメモ

My.Application.CommandLineArgs プロパティは、コマンド ライン引数のみを返します。この点で、引数以外にアプリケーション名を返す CommandLine プロパティとは動作異なります

My.Application.CommandLineArgs プロパティ使ったタスクの例を次の表に示します

使用例使用例

この例では、My.Application.CommandLineArgs プロパティ使用してアプリケーションコマンド ライン引数調べてます。/input= で始まる引数見つかった場合は、その引数残り部分表示されます。

Private Sub ParseCommandLineArgs()
    Dim inputArgument As String
 = "/input="
    Dim inputName As String
 = ""

    For Each s As String
 In My.Application.CommandLineArgs
        If s.ToLower.StartsWith(inputArgument) Then
            inputName = s.Remove(0, inputArgument.Length)
        End If
    Next

    If inputName = "" Then
        MsgBox("No input name")
    Else
        MsgBox("Input name: " & inputName)
    End If
End Sub
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConsoleApplicationBase クラス
ConsoleApplicationBase メンバ
Microsoft.VisualBasic.ApplicationServices 名前空間
ReadOnlyCollection
ConsoleApplicationBase.CommandLineArgs プロパティ
StartupEventArgs
CommandLine
その他の技術情報
My.Application.CommandLineArgs プロパティ
My.Application オブジェクト
My.Application.StartupNextInstance イベント



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ConsoleApplicationBase.CommandLineArgs プロパティ」の関連用語

ConsoleApplicationBase.CommandLineArgs プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ConsoleApplicationBase.CommandLineArgs プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS