Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Parameters with spaces on execute command on management server

Parameters with spaces on execute command on management server

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 23.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    J
    Marco Incalcaterra
    wrote on last edited by
    #1

    Hi,

    I wrote a small program to notify some events via the execute command on management server action property, it works properly unless I put parameters inside double quotes. I'll try to better explain with an example:

    This command works properly:

    c:\\test\\myprg.exe firstpar secondpar thirdpar

    This command doesn't work:

    c:\\test\\myprg.exe "first par" "second par" "third par"

    Is there a way to specify parameters that have spaces (my parameters are strings)?

    Best regards,
    Marco.

    1 Reply Last reply
    0
    • V
      V
      Victor Kirhenshtein
      wrote on last edited by
      #2

      Hi!

      That's strange. Just checked it on my development server, and commands with parameters enclosed in double quotes works just fine. What server version you are using? Also, can you determine what parameters are passed to your program?

      I use the following small test program:

      #include <stdio.h>
      
      int main(int argc, char *argv[])
      {
      	FILE *f = fopen("c:\\temp\\s.log","w");
      	fprintf(f, "p1: %s\n", argv[1]);
      	fprintf(f, "p2: %s\n", argv[2]);
      	fprintf(f, "p3: %s\n", argv[3]);
      	fclose(f);
      	return 0;
      }
      

      and for action with command

      c:\\source\\s.exe "first par" "second par" "third par"

      got correct output in c:\temp\s.log:

      p1: first par
      p2: second par
      p3: third par

      Best regards,
      Victor

      1 Reply Last reply
      0
      • J
        J
        Marco Incalcaterra
        wrote on last edited by
        #3

        Hi Victor,

        sorry for the long time reply, bad days... I'm using server version 1.1.3. I prepared an action to send SMS using a small prog I wrote, currently the "command" section is:

        "C:\\Program Files\\NetXMS\\SMSTool\\SMSTx.exe" -n smsnumber1 -n smsnumber2 -t WebServerUnreachable-%n(%a)

        while the original one (that doesn't work) was:

        "C:\\Program Files\\NetXMS\\SMSTool\\SMSTx.exe" -n smsnumber1 -n smsnumber2 -t "Error web server is unreachable: %n (%a)"

        Using the above statement I only got "Error" and the part " web server is unreachable: %n (%a)" never arrives to my program. Can be the parser that expand the %n and %a that removes the double quotes before posting it to the program? For now I solved removing the spaces but for the future can be interesting to send more complex texts.

        Thank you very much for your help.

        Best regards,
        Marco.

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        Powered by NodeBB Contributors
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups