ProcessStartInfo.UseShellExecute プロパティ
アセンブリ: System (system.dll 内)

Dim instance As ProcessStartInfo Dim value As Boolean value = instance.UseShellExecute instance.UseShellExecute = value
/** @property */ public boolean get_UseShellExecute () /** @property */ public void set_UseShellExecute (boolean value)
public function get UseShellExecute () : boolean public function set UseShellExecute (value : boolean)
プロセスを起動するときにシェルを使用する場合は true。それ以外の場合、プロセスは実行可能ファイルから直接作成されます。既定値は true です。

このプロパティを false に設定すると、入力、出力、エラーの各ストリームをリダイレクトできます。
![]() |
---|
UserName プロパティが null 参照 (Visual Basic では Nothing) や空の文字列でない場合、または Process.Start(ProcessStartInfo) メソッドを呼び出したときに InvalidOperationException がスローされる場合、UseShellExecute を false に設定する必要があります。 |
オペレーティング システムのシェルを使用してプロセスを起動すると、Process コンポーネントを使用して、任意のドキュメント (任意の登録済みファイル タイプ。既定の "open" アクションが実行できるように関連付けられています。) を起動し、印刷などのファイルに対する操作を実行できます。UseShellExecute が false の場合は、Process コンポーネントを使用して、実行可能ファイルの起動だけ実行できます。
WorkingDirectory プロパティの動作は、UseShellExecute が true の場合と UseShellExecute が false の場合とで異なります。UseShellExecute が true の場合は、WorkingDirectory プロパティは実行可能ファイルの場所を指定します。WorkingDirectory が空の文字列の場合は、現在のディレクトリに実行可能ファイルが格納されていると解釈されます。
UseShellExecute が false の場合は、実行可能ファイルの検索に WorkingDirectory プロパティは使用されません。代わりに、このプロパティは起動されるプロセスにより使用され、新しいプロセスのコンテキスト内でだけ意味を持ちます。

compiler.StartInfo.FileName = "csc.exe" compiler.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs" compiler.StartInfo.UseShellExecute = False compiler.StartInfo.RedirectStandardOutput = True compiler.Start() Console.WriteLine(compiler.StandardOutput.ReadToEnd()) compiler.WaitForExit()
Process compiler = new Process(); compiler.StartInfo.FileName = "csc.exe"; compiler.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs"; compiler.StartInfo.UseShellExecute = false; compiler.StartInfo.RedirectStandardOutput = true; compiler.Start(); Console.WriteLine(compiler.StandardOutput.ReadToEnd()); compiler.WaitForExit();
Process^ compiler = gcnew Process; compiler->StartInfo->FileName = "cl.exe"; compiler->StartInfo->Arguments = "/clr stdstr.cpp /link /out:sample.exe"; compiler->StartInfo->UseShellExecute = false; compiler->StartInfo->RedirectStandardOutput = true; compiler->Start(); Console::WriteLine( compiler->StandardOutput->ReadToEnd() ); compiler->WaitForExit();

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に収録されているすべての辞書からProcessStartInfo.UseShellExecute プロパティを検索する場合は、下記のリンクをクリックしてください。

- ProcessStartInfo.UseShellExecute プロパティのページへのリンク