Author Topic: Rexx close cmd.exe  (Read 290 times)

Per E. Johannessen

  • Full Member
  • ***
  • Thank You
  • -Given: 5
  • -Receive: 2
  • Posts: 185
  • Karma: +3/-0
    • View Profile
Rexx close cmd.exe
« 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?

Andreas Schnellbacher

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 40
  • Posts: 733
  • Karma: +13/-0
    • View Profile
Re: Rexx close cmd.exe
« Reply #1 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'
« Last Edit: November 12, 2021, 05:01:27 pm by Andreas Schnellbacher »

Per E. Johannessen

  • Full Member
  • ***
  • Thank You
  • -Given: 5
  • -Receive: 2
  • Posts: 185
  • Karma: +3/-0
    • View Profile
Re: Rexx close cmd.exe
« Reply #2 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.