Skip to main content

[Migrated content. Thread originally posted on 22 November 2011]

Hello,

Have you got any example passing parameters to a managed app from the command line?

I have tried with "linkage section" but it seems only works with native applications.

Thanks.

[Migrated content. Thread originally posted on 22 November 2011]

Hello,

Have you got any example passing parameters to a managed app from the command line?

I have tried with "linkage section" but it seems only works with native applications.

Thanks.
Do not worry. I found it.

       class-id MNGMenuWin.Menu.
       
       method-id Main static
           attribute System.STAThread.
       local-storage section.
       01 mainForm type MNGMenuWin.Form1.
       procedure division using by value cmds as string occurs any.
       
           set mainForm to new MNGMenuWin.Form1(cmds(1))
           invoke type System.Windows.Forms.Application::EnableVisualStyles()
           invoke type System.Windows.Forms.Application::Run(mainForm)
           goback.
       
       end method.
       
       end class.

[Migrated content. Thread originally posted on 22 November 2011]

Hello,

Have you got any example passing parameters to a managed app from the command line?

I have tried with "linkage section" but it seems only works with native applications.

Thanks.
You can either use (which is portable):
  working-storage section.
  01 cmdline pic x(100).
  procedure division.
  accept cmdline from command-line

Or use the .Net property Environment.CommandLine

Or use: (portable between .Net & JVM)

01 arg string.

procedure division using by value args as string occurs any.
  perform varying arg through args
   display " -> " arg
  end-perform