LaunchExecutable
int LaunchExecutable (char filename[]);
Purpose
![]() |
Note This function has been superseded by LaunchExecutableEx. |
Starts running a program and returns without waiting for the program to exit. The executable can be a DOS or Windows executable, including *.exe, *.com, *.bat, and *.pif files.
![]() |
Note If you want to wait for the program to exit, use the systemsystem function in the ANSI C Library. If you want to monitor whether the launched executable has terminated, use LaunchExecutableEx. |
The program must be an actual executable; that is, you cannot launch commands intrinsic to a command interpreter.
.exe, .com, and .bat DOS programs use the settings in _default.pif in the Windows directory when running. You can change settings such as priority and display options by editing _default.pif or by creating another .pif file. For more information about creating and editing .pif files, refer to www.msdn.com.
If you need to execute a command built into cmd.exe, such as copy or dir, you can call LaunchExecutable with the following command:
cmd.exe /c command args
where command is the command you want to execute. For example, the following function call copies file.tmp from the temp directory to the tmp directory:
LaunchExecutable ("cmd.exe /c copy c:\\temp\\file.tmp c:\\tmp");
For more information about cmd.exe, refer to www.msdn.com.
Parameters
Input | ||
Name | Type | Description |
filename | char [] | Pathname of executable file to run. If the program is not in one of the directories specified in the PATH environment variable, you must specify the full path. The path can include arguments to pass to the program. If the program is a .pif, .bat, or .com file, you must include the extension in the pathname. For example, under Windows, the following function call launches the Edit program with the file file.dat: LaunchExecutable ("edit.com c:\\file.dat"); |
Return Value
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
result | int | Result of the operation. Error codes vary, depending on whether you have a Windows or Linux application.
|
Additional Information
Library: Utility Library
Include file: utility.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later