Accessing command line arguments from web app

Ok I know this is probably weird but I need to pass some parameters on the command line to my web app but when I use the system.commandline it doesnt return what I have put in the IDE as the command line arguments. This is going to be a WIndows only app so is their some way of doing this?

I don’t know about from the IDE, but I know System.CommandLine works on built apps, as I use it.

I have just compiled the app and it does work, thanks, doesnt appear to work in the IDE itself but does when compiled.

From the IDE make sure you set the “Debug Command line” item in the shared build settings
Those will get passed to the debug app when its launched

Where is that option as I cannot see it. I am running under Windows and it is a web project. Under Shared, I have the heading Version, Build, Debug but in none of those sections is the option you are suggesting.

In the debug section you can see “Command Line Arguments” which is the top field. If you’ve shrunk the Inspector you may only see nts.

Ok sorry misunderstood Normans post. I have set these to “/path=d:\apps\mydata\ /user=njw” and on page shown I have a msgbox system.commandline but it only returns the path to the app and not the parameters but when I compile it returns the path and the command line parameters.

I know that a standalone app does have several default args that it uses for overriding certain compile time settings
Not sure if that impacts this but it might

I guess that might be it. As I say it seems to work fine when you compile but not when in the IDE. Its not a massive issue as I have put some code in to test if it is in the IDE and put the test data I am using directly in which results in the same as adding it to the command line argument in the IDE but it might be a good idea if the field was disabled in web apps otherwise other users might get confused. Should I log this as a Feedback post as a bug or feature request or something else?

File a bug report about the debug command line parameters not being passed to a web app when doing a debug run

I have logged in Feedback:

33253 - Command line arguments not being passed in web app

I too ran into this problem today. The only work around is to flip it to stand alone, compile, and then test?

This bug was already reported as case #31347.
Now the application gets App.ExecutableFile.NativePath instead of what was App.ExecutableFile.ShellPath but still no parameters.

It seems that now in Windows 7 ShellPath and NativePath are the same i.e. no more short names (at least when debugging a standalone WebApp).

Regards.

Have you tested in r2? We added “args() as String” to App.Open which should show you all of the arguments passed to the app.

Yes, it does not work from the IDE. I did:

  1. New Project
  2. Web
  3. App Name: sdf
  4. Build Settings > Shared > Command Line Arguments and entered HI
  5. Added an Open event to App, populated with:

System.DebugLog Str(args.Ubound)
For Each a As String In args
System.DebugLog a
Next

  1. Click Run

The output in the debug messages is:

9:30:55 AM
sdf Launched
Jul 16 09:30:55 Jeremys-iMac.local sdf.debug[97903] <Warning>: 0
Jul 16 09:30:55 Jeremys-iMac.local sdf.debug[97903] <Warning>: /private/var/folders/75/mfyh29350s17b4p5yhr18wxw0000gn/T/TemporaryItems/sdf.debug/sdf.debug
9:31:05 AM
sdf Ended
Process Completed.

Any ETA on this?

Just played on a Windows web app executable, and in App Open event, the arg array does report all arguments passed to the app, like

MyApplication.exe --port=8080 firstarg secondarg etc

I have placed that in an app property and was able to access it throughout.

Yes the issue is specifically that it does not work in debug mode. If you set the parameters on the ‘Shared’ App settings. On the Mac at least the parameters never show (like they are not being passed).

It does work in a full build.

You already know the answer to this question