Keep Command Prompt Window Open After Running LabVIEW System Exec VI

Updated Nov 8, 2022



  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

I am using the LabVIEW System Exec VI to launch an MS-DOS based program. After the program (or batch file) runs, it automatically closes the command prompt window. I want the window to stay open after the program finishes execution. Is this possible?

Yes, you can achieve this behavior by customizing the command line input of the System Exec VI as follows:
  1. Original command line input: <myDOSCommand>
Customized command line input: cmd /K <myDOSCommand>
  1. ​Wire a False constant to the "wait until completion?" input of the System Exec VI.

The cmd /K will open a command prompt window with the option to keep the window open after execution. 

Note: You may have to substitute cmd above with command.

Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

Additional Information

To get a complete list of these command line options, open a command prompt window by going to Start >> Run and typing in cmd and then type cmd /? in the window to get a listing of all the options.