Example1:
Example 1 shows how to start the Windows Notepad with the autoexec.bat file loaded.
WORKING-STORAGE SECTION. 01 Command-Line PIC X(128). 01 ReturnValue PIC S9(9) COMP-5. PROCEDURE DIVISION. MOVE "Notepad c:\autoexec.bat" TO Command-Line INVOKE CmDDE1 "Execute" USING Command-Line POW-SWSHOWNORMAL RETURNING ReturnValue
Example 2:
Example 2 demonstrates how to execute a Dir command.
ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 Command-Line PIC X(128). 01 ReturnValue PIC S9(9) COMP-5. PROCEDURE DIVISION. * The "/K" option tells CMD to keep the window open so you * can see the results. Change this to "/C" if you want the * window to close after the command executes. MOVE "CMD /K Dir *.*" TO Command-Line INVOKE CmDDE1 "Execute" USING Command-Line POW-SWSHOWNORMAL RETURNING ReturnValue