Assembly: System (in system.dll)
/** @property */ public boolean get_UseShellExecute () /** @property */ public void set_UseShellExecute (boolean value)
public function get UseShellExecute () : boolean public function set UseShellExecute (value : boolean)
Property Valuetrue to use the shell when starting the process; otherwise, the process is created directly from the executable file. The default is true.
Setting this property to false enables you to redirect input, output, and error streams.
UseShellExecute must be false if the UserName property is not a null reference (Nothing in Visual Basic) or an empty string, or an InvalidOperationException will be thrown when the Process.Start(ProcessStartInfo) method is called.
When you use the operating system shell to start processes, you can start any document (which is any registered file type associated with an executable that has a default open action) and perform operations on the file, such as printing, with the Process component. When UseShellExecute is false, you can start only executables with the Process component.
UseShellExecute must be true if you set the ErrorDialog property to true.
The WorkingDirectory property behaves differently when UseShellExecute is true than when UseShellExecute is false. When UseShellExecute is true, the WorkingDirectory property specifies the location of the executable. If WorkingDirectory is an empty string, the current directory is understood to contain the executable.
When UseShellExecute is false, the WorkingDirectory property is not used to find the executable. Instead, it is used by the process that is started and has meaning only within the context of the new process.
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 Server 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 EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.