This article illustrates four ways to start a program containing spaces in the path or filename from COBOL.
Problem:
How can an EXE be started by a COBOL program when the path or EXE name contains spaces?
Using a Move “My Path\\My Prog.exe My Parameters” to my-command-lineand trying to start the EXE by CBL_EXEC_RUN_UNIT will fail.
Resolution:
The attached demo shows four ways to start a program.exe with spaces in the path or filename. The main idea is that the path\\program has either to be included in quotes:
- Move ‘“My Path\\My Prog.exe” My Parameters’ to my-command-line, or
- Convert to short name following the 8.3 convention immediately before the program is called.
You can use either a CALL “system”, or the WinApi CreateProcess, or the CBL_EXE_RUN_UNIT to start the EXE.
Incident Number: 2352021