Show/Hide Toolbars


NoteThis command is defined in a header file and will be preprocessed by the X# preprocessor to a function call. If you disable the standard header (-nostddefs) files then this command will not be available. If you tell the compiler to use a different standard header file (-stddef ) then this command may also be not available


Execute a Windows or DOS application, a batch file, or a DOS command.


RUN <xcCommandLine>


<xcCommandLine>The command line is made up of two parts.  The first part is one of the following:

An executable Windows or DOS program

A .PIF file

A .BAT file

Any resident DOS command


The second part is the command line parameters that will be passed to the specified application.
NOTE: When running DOS programs, it is best to specify the file extension (for example, .EXE) rather than allow DOS to determine the default; otherwise, the RUN command will generate a temporary file named VODOSRUN.BAT to run the specified program.


RUN executes a Windows or DOS program or a DOS command from within an application.

The application name in <xcCommandLine> may optionally contain a path.  If it does not, Windows will search for the application in the following order:

       The current directory

       The Windows directory

       The Windows SYSTEM subdirectory

       The directory that contains the currently executing module (.EXE or .DLL)

       The directories in the PATH environment variable

       All network drives


If you use RUN to start a Windows application, the two applications will be run asynchronously.  In other words, your  XSharpapplication will not wait for the called application to finish but will continue to execute the instructions following the RUN command.


If you specify a DOS application, a .BAT file, or a DOS command, Windows will create a DOS task and switch to it, thereby stopping your application.  During the execution of the DOS task, however, the user may switch back to the calling application..  The calling application will automatically resume execution after the DOS task terminates.

If you run a DOS program, you might consider setting up a .PIF file (using the PIF Editor provided by Windows) to fine tune the execution environment.  For example you might specify that the DOS application is to be executed in a window rather than in full-screen mode.  If you are using a .PIF file, pass the name of the .PIF file to the RUN command instead of the name of your application or give it the same base name as your application and put it into the same directory.  In the latter case, Windows will pick it up automatically if you pass the application name to the RUN command.


This example starts the Windows Notepad editor on a file called DATA.TXT:


RUN notepad data.txt


One of the options you can give your users is direct access to DOS.  Do this with: