The following code executes the dir command on the C:\ directory and outputs the result to a String Indicator. The command line does not open, and the program halts code execution until the command has returned results.
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.
Alternatively, the implementation shown below will open a command prompt window and execute the dir command on the C:\ within the command prompt. The /k argument forces the command prompt window to stay open so that you can see the results of the dir command. Using this method, LabVIEW and the command prompt window will run asynchronously. In other words, after starting the command window and passing the command to it, LabVIEW will continue executing the next VI in your code while the command prompt window responds to the dir 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.