Environment.CommandLine プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


このプロパティは、現在のプロセスの開始時にコマンド ラインで指定されたプログラム名および引数へのアクセスを提供します。
プログラム名にはパス情報を含めることができますが、必須ではありません。解析され、文字列の配列に格納されたコマンド ライン情報を取得するには、GetCommandLineArgs メソッドを使用します。
Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 プラットフォームメモ : 実行可能ファイルの名前にパスは含まれません。
Windows 98, Windows Millennium Edition プラットフォームメモ : 実行可能ファイルの名前にパスが含まれます。長いファイル名 (8.3 形式ではないファイル名) は、8.3 形式に短縮される可能性があります。

アプリケーション自身のコマンド ラインを表示するコード例を次に示します。
' Sample for the Environment.CommandLine property. Imports System Class Sample Public Shared Sub Main() Console.WriteLine() ' Invoke this sample with an arbitrary set of command line arguments. Console.WriteLine("CommandLine: {0}", Environment.CommandLine) End Sub 'Main End Class 'Sample ' 'This example produces the following results: ' 'C:\>CommandLine ARBITRARY TEXT ' 'CommandLine: CommandLine ARBITRARY TEXT '
// Sample for the Environment.CommandLine property. using System; class Sample { public static void Main() { Console.WriteLine(); // Invoke this sample with an arbitrary set of command line arguments. Console.WriteLine("CommandLine: {0}", Environment.CommandLine); } } /* This example produces the following results: C:\>env0 ARBITRARY TEXT CommandLine: env0 ARBITRARY TEXT */
// Sample for the Environment::CommandLine property. using namespace System; int main() { Console::WriteLine(); // Invoke this sample with an arbitrary set of command line arguments. Console::WriteLine( "CommandLine: {0}", Environment::CommandLine ); } /* This example produces the following results: C:\>env0 ARBITRARY TEXT CommandLine: env0 ARBITRARY TEXT */
// Sample for the Environment.CommandLine property. import System.*; class Sample { public static void main(String[] args) { Console.WriteLine(); // Invoke this sample with an arbitrary set of command line arguments. Console.WriteLine("CommandLine: {0}", Environment.get_CommandLine()); } //main } //Sample /* This example produces the following results: C:\>env0 ARBITRARY TEXT CommandLine: env0 ARBITRARY TEXT */


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からEnvironment.CommandLine プロパティを検索する場合は、下記のリンクをクリックしてください。

- Environment.CommandLine プロパティのページへのリンク