| xHarbour Reference Documentation > Command Reference |
![]() |
![]() |
![]() |
Executes an operating system command.
RUN <CommandLine>
The RUN command opens a new command shell and executes the operating system commands specified with <CommandLine>.
RUN does not return until <CommandLine> is completed by the operating system. When RUN is complete, the new command shell is closed.
| See also: | ( ), FUNCTION, PROCEDURE |
| Category: | Statements |
| Source: | vm\run.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example executes the DIR command, directs its output into
// a file and displays the result with Notepad.exe
PROCEDURE Main
LOCAL cCommand := "Notepad.exe files.lst"
CLS
? "DIR command"
RUN dir > files.lst
? "Executing Notepad.exe"
RUN (cCommand)
? "Done"
RETURN
http://www.xHarbour.com