OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Per E. Johannessen on November 12, 2021, 03:54:31 pm

Title: Rexx close cmd.exe
Post by: Per E. Johannessen on November 12, 2021, 03:54:31 pm
Hi,

I'm running this from a VX-Rexx program;

address cmd "start D:\GS\GS9.15\BIN\gsos2 -dQUIET -sDEVICE=pdfwrite -o d:\PDF\modified.pdf d:\PDF\source.ps -f d:\PDF\source.pdf"

and it brings up a cmd window that remain open after the script has finished.

Would prefer not to see that cmd window at all or at least get it closed automatically.
Have searched without finding what I need so I hope I have not overlooked the obvious :)

Suggestions?
Title: Re: Rexx close cmd.exe
Post by: Andreas Schnellbacher on November 12, 2021, 04:26:08 pm
Add /c to cmd.exe and /min to start. See:

Code: [Select]
start view cmdref cmd
start view cmdref start

What should also work is to remove the leading 'address cmd'. Then the default COMSPEC is used to execute an enquoted line, either single or double quotes:

Code: [Select]
'start /min D:\GS\GS9.15\BIN\gsos2 -dQUIET -sDEVICE=pdfwrite -o d:\PDF\modified.pdf d:\PDF\source.ps -f d:\PDF\source.pdf'

This starts an asynchronous process. To start a synchronous process, use 'call'. In many cases also 'call' can be omitted. Note that cmd's call is different from the REXX call statement:

Code: [Select]
'call D:\GS\GS9.15\BIN\gsos2 -dQUIET -sDEVICE=pdfwrite -o d:\PDF\modified.pdf d:\PDF\source.ps -f d:\PDF\source.pdf'
Title: Re: Rexx close cmd.exe
Post by: Per E. Johannessen on November 12, 2021, 05:02:37 pm
Had already tried with cmd /c but that results in "invalid expression".
Thanks for pointing me to "start view cmdref start", I now added /c /min to start and it works.